Copilot commented on code in PR #3857:
URL: https://github.com/apache/avro/pull/3857#discussion_r3564611315


##########
lang/csharp/src/apache/main/File/DataFileReader.cs:
##########
@@ -335,6 +335,11 @@ public bool HasNext()
                     {
                         _currentBlock = NextRawBlock(_currentBlock);
                         _currentBlock.Data = 
_codec.Decompress(_currentBlock.Data, (int)_blockSize);
+                        // Guard against a block that decompresses to more 
than the
+                        // allowed maximum (a decompression bomb). The 
built-in deflate
+                        // codec is already bounded during decompression; this 
covers
+                        // any codec that returns a fully decompressed buffer.
+                        Codec.CheckDecompressLength(_currentBlock.Data.Length, 
Codec.GetMaxDecompressLength());

Review Comment:
   `Codec.CheckDecompressLength` now throws an actionable 
`AvroRuntimeException`, but `HasNext()` catches *all* exceptions and wraps them 
into a new `AvroRuntimeException` without preserving the original as an inner 
exception. This obscures the decompression-limit message and prevents callers 
from distinguishing the root cause. Consider rethrowing `AvroRuntimeException` 
directly so the decompression-limit error can propagate cleanly.



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