Copilot commented on code in PR #3854:
URL: https://github.com/apache/avro/pull/3854#discussion_r3564678561
##########
lang/c++/impl/ZstdDecompressWrapper.cc:
##########
@@ -43,9 +43,20 @@ std::string ZstdDecompressWrapper::decompress(const
std::vector<char> &compresse
if (ZSTD_isError(ret)) {
throw Exception("ZSTD decompression error: {}",
ZSTD_getErrorName(ret));
}
+ // Reject before appending so the buffer never grows past the
limit.
+ if (out.pos > maxLength - uncompressed.size()) {
+ throw Exception(
+ "Decompressed block size exceeds the maximum allowed of {}
bytes", maxLength);
+ }
Review Comment:
In the Zstandard streaming (unknown frame size) path, the exception message
omits the attempted decompressed size, unlike the fixed-size Zstd path and
Snappy path which report the offending size. Including the would-be size makes
debugging and log correlation easier when the limit is hit.
--
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]