OwenSanzas commented on code in PR #3623:
URL: https://github.com/apache/avro/pull/3623#discussion_r2688602000


##########
lang/c/src/datafile.c:
##########
@@ -451,6 +451,10 @@ static int file_read_block_count(avro_file_reader_t r)
                     "Cannot read file block count: ");
        check_prefix(rval, enc->read_long(r->reader, &len),
                     "Cannot read file block size: ");
+       if (len < 0) {

Review Comment:
   1. Well I think len==0 is ok here. It seems that     
   
   } else if (!r->current_blockdata) {
                r->current_blockdata = (char *) avro_malloc(len); // this will 
return NULL
                r->current_blocklen = len;
        }
   
   And len == 0 won't break other logic. Also it wont let the reading/decoding 
happen.
   
   If previous design considered len == 0, I think len < 0 here is enough
   
   I tried len == 0 and it passes some test cases I generated.



-- 
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