Repository navigation
Reject truncated Zstandard event logs - #274
gerashegalov wants to merge 1 commit into
Conversation
Signed-off-by: Gera Shegalov <gshegalov@nvidia.com>
|
| raise EventLogReadError( | ||
| "Truncated Zstandard frame", retryable=True | ||
| ) | ||
| output = frame.decompress(compressed) |
There was a problem hiding this comment.
Unbounded decompression allocation A highly compressible
.zstd event-log block can expand far beyond READ_SIZE in this single decompress() call. Slicing the result afterward limits the chunks yielded, but the full result has already been allocated, so a small supplied event log can exhaust the reader’s memory. The previous reader limited decompressed output per read; this path needs an output-side bound. How this was verified: Supplied .zstd event-log bytes reach this call, which materializes the expanded output before the chunking loop runs.
Summary
Follow-up to #272.
Testing
python -m py_compile yarn-resource-cost/*.pypython -m unittest discover -s yarn-resource-cost -p 'test*.py'on Python 3.10, 3.11, and 3.12 withzstandard==0.23.0(64 tests each)python -m unittest discover -s yarn-resource-cost -p 'test*.py'withzstandard==0.25.0(64 tests)python yarn-resource-cost/package_yarn_job_cost.py --output-dir /tmp/csb-zstd-truncation-distgit diff --check