Rich-T-kid commented on code in PR #12077:
URL: https://github.com/apache/arrow-rs/pull/12077#discussion_r4475702172
##########
arrow-ipc/src/compression.rs:
##########
@@ -386,6 +377,37 @@ fn decompress_zstd(
))
}
+/// Reads `decoder` to its end, expecting `len` bytes, without reserving `len`
up front.
+///
+/// `len` comes from the sender, so the buffer starts at no more than
`MAX_PREALLOC_BYTES` and
+/// doubles, capped at `len`, only as the decoder fills it: a length the data
does not back costs
+/// one bounded allocation, and the buffer never runs more than a factor of
two ahead of the
+/// decompressed bytes.
+#[cfg(any(feature = "lz4", feature = "zstd"))]
Review Comment:
The ZSTD branch above can stay as-is. With the LZ4 path restored by the
earlier suggestion, this helper is only used for ZSTD inputs whose declared
size exceeds `MAX_PREALLOC_BYTES`, so narrow the feature gate accordingly. This
keeps the change to the small size checks and capped initial allocations
without routing LZ4 through new shared code.
```suggestion
#[cfg(feature = "zstd")]
```
--
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]