iemejia commented on code in PR #3851:
URL: https://github.com/apache/avro/pull/3851#discussion_r3564712876


##########
lang/ruby/lib/avro/data_file.rb:
##########
@@ -339,6 +372,13 @@ def codec_name; 'snappy'; end
 
       def decompress(data)
         load_snappy!
+        # The Snappy block header declares the uncompressed length as a varint;
+        # reject an over-large block before allocating for it.
+        limit = DataFile.max_decompress_length
+        declared = self.class.snappy_declared_length(data)
+        if declared && declared > limit
+          raise DecompressionSizeError, "Decompressed block size exceeds the 
maximum allowed of #{limit} bytes"
+        end

Review Comment:
   Fixed. SnappyCodec#decompress now fails closed: an unparseable length header 
(snappy_declared_length returns nil) raises DataFileError before decompression 
instead of falling through to Snappy.inflate. Added a test for a 
never-terminating header. Pushed in d96c9bd.



-- 
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]

Reply via email to