Copilot commented on code in PR #3865:
URL: https://github.com/apache/avro/pull/3865#discussion_r3567534281


##########
lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java:
##########
@@ -408,8 +408,16 @@ protected void doReadBytes(byte[] bytes, int start, int 
length) throws IOExcepti
   protected long doReadItemCount() throws IOException {
     long result = readLong();
     if (result < 0L) {
-      // Consume byte-count if present
+      // A negative block count is followed by a block byte-size; consume it.
       readLong();
+      if (result == Long.MIN_VALUE) {

Review Comment:
   doReadItemCount() consumes the block byte-size for negative-count blocks but 
does not validate it. Since doSkipItems() now rejects a negative block 
byte-size as malformed, the read path should do the same to avoid accepting 
invalid Avro encodings silently and to keep read/skip behavior consistent.



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