showuon commented on code in PR #13100: URL: https://github.com/apache/kafka/pull/13100#discussion_r1066632142
########## clients/src/main/java/org/apache/kafka/common/protocol/types/TaggedFields.java: ########## @@ -100,6 +100,13 @@ public NavigableMap<Integer, Object> read(ByteBuffer buffer) { } prevTag = tag; int size = ByteUtils.readUnsignedVarint(buffer); + if (size < 0 && isNullable()) + return null; + else if (size < 0) + throw new SchemaException("field size " + size + " cannot be negative"); + if (size > buffer.remaining()) + throw new SchemaException("Error reading field of size " + size + ", only " + buffer.remaining() + " bytes available"); Review Comment: That's a good point. I'll work on it. Thanks. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org