Repository navigation
Do not recurse per empty block in the hadoop-snappy reader - #116994
Conversation
A hadoop-snappy block that declares zero uncompressed bytes decodes to nothing, and `HadoopSnappyReadBuffer::nextImpl` returned `true` for it with an empty `working_buffer`. `ReadBuffer::next` calls itself in that case, so a stream of such blocks consumed one stack frame each and could exhaust the stack in builds where the compiler does not turn the self-call into a jump. Keep decoding until there is output or the input ends, the same way `SnappyFramedReadBuffer` already skips zero-length chunks.
|
Workflow [PR], commit [f65dc62] Summary: ✅
AI ReviewSummaryThis PR fixes Final Verdict
LLVM Coverage ReportMeasured on commit f65dc62.
Changed lines: Changed C/C++ lines covered: 25/30 (83.33%) · Uncovered code |
`decoder->reset()` is ambiguous between resetting the decoder and resetting the pointer that holds it, which `readability-ambiguous-smartptr-reset-call` rejects; spell it through the reference, as the code did before. Also state in the test what its signal is: the fix changes nothing but the recursion, so the crash is what the test observes, and that only happens in the builds that keep the self-call in `ReadBuffer::next`.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 5 s compile time in total, 7 of them have a recent master baseline. |
…mpty-block-recursion
…mpty-block-recursion
Backport #116994 to 26.7: Do not recurse per empty block in the hadoop-snappy reader
Backport #116994 to 26.8: Do not recurse per empty block in the hadoop-snappy reader
Backport #116994 to 26.6: Do not recurse per empty block in the hadoop-snappy reader
Backport #116994 to 26.3: Do not recurse per empty block in the hadoop-snappy reader
… the hadoop-snappy reader
… the hadoop-snappy reader
Closes: https://github.com/ClickHouse/clickhouse-private/issues/71249
A hadoop-snappy block that declares zero uncompressed bytes decodes to nothing, and
HadoopSnappyReadBuffer::nextImplreturnedtruefor it with an emptyworking_buffer.ReadBuffer::nextcalls itself in that case, so a stream of such blocks consumed one stack frame each and could exhaust the stack in builds where the compiler does not turn the self-call into a jump.Keep decoding until there is output or the input ends, the same way
SnappyFramedReadBufferalready skips zero-length chunks.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a stack overflow when reading hadoop-snappy data containing many blocks that decode to nothing.
Workflow [PR]
Sync PR [sync-upstream/pr/116994]
Version info
26.9.1.694(included in26.9and later)26.8.3.36,26.7.7.26,26.6.5.51,26.3.31.10