fix result buffer overrun in decode-only benchmark

This commit is contained in:
Saleem Malik 2026-07-23 13:50:00 +05:30
parent 5c7b7bad26
commit 902247b318
2 changed files with 6 additions and 1 deletions

View file

@ -517,7 +517,7 @@ static BMK_benchOutcome_t BMK_benchMemAdvancedNoAlloc(
: chunkSize;
srcPtr += chunkSize;
cPtr += cCapacities[chunkID];
resPtr += chunkSize;
resPtr += resSizes[chunkID];
remaining -= chunkSize;
if (adv->mode == BMK_decodeOnly) {
cSizes[chunkID] = chunkSize;

View file

@ -1308,6 +1308,11 @@ zstd -f tmp1
zstd -b -d -i0 tmp1.zst
println "benchmark can fail - decompression on invalid data"
zstd -b -d -i0 tmp1 && die "invalid .zst data => benchmark should have failed"
println "benchmark decompression of several frames whose content is smaller than the frame"
printf 'a' > tmpbd1 ; printf 'b' > tmpbd2 ; printf 'c' > tmpbd3
zstd -qf tmpbd1 tmpbd2 tmpbd3
zstd -b -d -i0 tmpbd1.zst tmpbd2.zst tmpbd3.zst
rm -f tmpbd1 tmpbd2 tmpbd3 tmpbd1.zst tmpbd2.zst tmpbd3.zst
GZIPMODE=1
zstd --format=gzip -V || GZIPMODE=0