Commit eb3ded1
snappy: fix multi-chunk framed data silently dropped
After the frame parsing loop accumulates the total decompressed
length in aggregated_data_length, the variable was incorrectly
reset to zero before being used for the output buffer allocation.
This caused the multi-chunk code path to skip allocation entirely,
producing a NULL output buffer and zero length with a success
return code — silently dropping all decompressed data.
Remove the erroneous reset so the accumulated length is preserved
and used for the aggregation buffer allocation. Also gate the
allocation on result == 0 and free any allocated buffer on error,
preventing a memory leak when a multi-chunk stream fails mid-way
(e.g. checksum mismatch after one valid chunk).
Signed-off-by: Gabriele Facundo <gabriele.facundo@cern.ch>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 7800ae2 commit eb3ded1
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
| |||
322 | 321 | | |
323 | 322 | | |
324 | 323 | | |
325 | | - | |
| 324 | + | |
326 | 325 | | |
327 | 326 | | |
328 | 327 | | |
| |||
357 | 356 | | |
358 | 357 | | |
359 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
360 | 365 | | |
361 | 366 | | |
362 | 367 | | |
| |||
0 commit comments