Gerrit0 commented on code in PR #3859:
URL: https://github.com/apache/avro/pull/3859#discussion_r3567565883


##########
lang/c++/include/avro/GenericDatum.hh:
##########
@@ -244,6 +244,9 @@ public:
      * \param branch The index for the selected branch.
      */
     void selectBranch(size_t branch) {
+        if (branch >= schema()->leaves()) {
+            throw Exception("Union branch index out of range: must be less 
than " + std::to_string(schema()->leaves()) + ", but is " + 
std::to_string(branch));
+        }

Review Comment:
   This has been my first real experience looking at reviews from AI... and 
wow, this thing has been _so confidently wrong_ (or at least just noise) in 
almost every instance. `leaves()` gives a `size_t`, this comment makes 
absolutely no sense. There's absolutely no need to check for negative values 
against an unsigned type...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to