iemejia commented on code in PR #3861:
URL: https://github.com/apache/avro/pull/3861#discussion_r3568152957
##########
lang/py/avro/io.py:
##########
@@ -383,8 +436,15 @@ def skip_int(self) -> None:
def skip_long(self) -> None:
b = ord(self.read(1))
+ count = 1
while (b & 0x80) != 0:
+ # A 64-bit varint is at most 10 bytes; reject an overlong chain so
a
+ # skipped long can't force scanning unbounded input (read_long caps
+ # the same way).
+ if count >= 10:
+ raise avro.errors.InvalidAvroBinaryEncoding("Varint is too
long")
b = ord(self.read(1))
+ count += 1
Review Comment:
Fixed — skip_long now tracks shift and applies the same 10th-byte check as
read_long (`shift == 63 and (b & 0x7E) != 0` raises InvalidAvroBinaryEncoding),
so a malformed 10-byte varint is rejected on the skip path too.
--
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]