mjsax commented on code in PR #23157:
URL: https://github.com/apache/kafka/pull/23157#discussion_r3808660768
##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/ChangedDeserializer.java:
##########
@@ -81,6 +82,9 @@ public Change<T> deserialize(final String topic, final
Headers headers, final by
}
case (byte) 2: {
final int newDataLength = ByteUtils.readVarint(buffer);
+ if (newDataLength < 0 || newDataLength > buffer.remaining() -
ENCODING_FLAG_SIZE) {
Review Comment:
I would simplify the code, removing ` - ENCODING_FLAG_SIZE` (similar below).
We don't need to try to have super strict bounds -- an "off by some bytes"
error on the bounds check doesn't do any harm.
Of course, also ok to leave as-is.
##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/ChangedDeserializer.java:
##########
@@ -81,6 +82,9 @@ public Change<T> deserialize(final String topic, final
Headers headers, final by
}
case (byte) 2: {
final int newDataLength = ByteUtils.readVarint(buffer);
+ if (newDataLength < 0 || newDataLength > buffer.remaining() -
ENCODING_FLAG_SIZE) {
+ throw new BufferUnderflowException();
Review Comment:
```suggestion
throw new SerializationException();
```
--
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]