Fix ROLZ inverse overread and transform test crashes#38
Conversation
Fix ROLZCodec1::inverse() so ifixedbuf only receives the encoded input bytes that remain after srcIdx. Small ROLZ chunks no longer expose a synthetic 64 KiB read window to the decoder. Move the transform test scratch buffer from the Windows stack to heap storage, and release FileTransformSequence on early exits so the harness does not leak state while running failure paths. Extend Kanzi quality CI into a regression contrast: build a known-bad MSVC x64 baseline and require the transform suite to fail there, build the fixed head and require it to pass, then run transform and CLI stream round-trip checks across gcc, clang, macOS, MSVC x64, and MSVC x86. The stream round trips now cover compression levels 1 through 9. Keep native-transform-quality.md out of the repository so it remains a local working note.
7bc4c95 to
c982054
Compare
|
Cleaned up the PR a bit |
|
Hey, thanks for the changes. |
|
|
Yeah... I made this PR too broad. The SRT/RANK/all crashes look like the test program using too much stack on Windows, so I kept that as a test-side fix. |



Fixes #37.
This fixes the crash from #37. I hit it through 7zFM + 7-Zip-zstd, then reduced it to kanzi-cpp.
Changes
ROLZCodec1::inverse()now passes only the encoded bytes left aftersrcIdxto the bitstream reader. Small ROLZ blocks no longer get a 64 KiB input window when fewer bytes are available.TestTransforms.cppmoves the 1 MiB temporary buffer from the stack to heap storage.Checks
On upstream commit
f5839572, an MSVC x64 build can reproduce the crash with:On this branch, the same commands pass.
The CI check does this in two steps:
f5839572with MSVC x64 and expects at least one of those transform commands to fail;That ties the CI check directly to #37.
It also compresses and decompresses generated random, structured, and mixed 4 MiB files with Kanzi CLI levels 1 to 9. SHA-256 hashes match after decompression.
Covered platforms: Ubuntu gcc, Ubuntu clang, macOS clang, MSVC x64, MSVC x86.
CI run:
https://github.com/BICHENG/kanzi-cpp/actions/runs/27264743969