kpumuk commented on code in PR #3706:
URL: https://github.com/apache/thrift/pull/3706#discussion_r3745610288
##########
lib/rb/lib/thrift/transport/header_transport.rb:
##########
@@ -336,15 +345,33 @@ def read_frame(req_sz)
# Handles unframed protocol - puts first_word back in buffer
def handle_unframed(first_word, req_sz)
+ @unframed_bytes_read = first_word.bytesize
+ raise_unframed_size_limit if @unframed_bytes_read > @max_frame_size
+
bytes_left = req_sz - 4
if bytes_left > 0
- rest = @transport.read(bytes_left)
+ rest = read_unframed(bytes_left)
@read_buffer = StringIO.new(first_word + rest)
else
@read_buffer = StringIO.new(first_word)
end
end
+ def read_unframed(size)
+ raise_unframed_size_limit if @unframed_bytes_read + size >
@max_frame_size
+
+ data = @transport.read(size)
+ @unframed_bytes_read += data.bytesize
+ data
+ end
Review Comment:
Addressed
--
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]