Jens-G commented on code in PR #3547:
URL: https://github.com/apache/thrift/pull/3547#discussion_r3314558029
##########
lib/rb/lib/thrift/transport/header_transport.rb:
##########
@@ -370,13 +385,48 @@ def parse_header_format(buf)
payload = buf.read
transforms.each do |transform_id|
if transform_id == HeaderTransformID::ZLIB
- payload = Zlib::Inflate.inflate(payload)
+ payload = bounded_inflate(payload)
end
end
StringIO.new(payload)
end
+ # Inflates +compressed+ with a running byte-count check against
@max_decompressed_size.
+ # Raises TransportException::SIZE_LIMIT if the decompressed output would
exceed the limit.
+ def bounded_inflate(compressed)
+ inflater = Zlib::Inflate.new
+ total = 0
+ chunks = []
Review Comment:
Feel free to edit the patch.
--
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]