iemejia opened a new pull request, #3850:
URL: https://github.com/apache/avro/pull/3850

   ## What is the purpose of the change
   
   The deflate and bzip2 codecs are inflated incrementally and rejected once 
the output would exceed the limit; snappy rejects an over-large declared length 
up front; zstandard caps its streaming loop. Exceeding the limit raises 
`avro.errors.AvroDecompressionSizeException`.
   
   When reading a data file, each block is decompressed according to the file's 
codec. A block with a very high compression ratio (or a malformed block) could 
expand to far more memory than its compressed size (a decompression bomb). This 
enforces a configurable maximum decompressed size while reading each block, 
mirroring the Java SDK's decompression limit (AVRO-4247). The limit defaults to 
200 MiB and can be overridden with the `AVRO_MAX_DECOMPRESS_LENGTH` environment 
variable.
   
   This is part of the umbrella issue AVRO-4283.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Added `avro/test/test_codecs.py` (`TestDecompressionSizeLimit`) covering 
deflate and bzip2 over-limit rejection and within-limit decoding 
(snappy/zstandard covered when those optional deps are installed).
   - Run: `cd lang/py && python3 -m unittest avro.test.test_codecs`
   
   ## Documentation
   
   - Does this pull request introduce a new feature? (no — hardening/robustness)
   - If yes, how is the feature documented? (not applicable; the new 
`AVRO_MAX_DECOMPRESS_LENGTH` environment variable is documented in code 
comments)
   


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