Commit ee62523
authored
Fix successful decompress reported as Error::Read (yhirose#1612)
* Fix successful decompress reported as Error::Read
Streams less than 4096 bytes are sometimes reported as failed reads because stream_.avail_in is not reduced to 0. The next iteration of the loop finds `prev_avail_in == strm_.avail_in` and return false. `ret = inflate(...)` returns Z_STREAM_END on the first iteration of the loop indicating that inflate is finished. This fix prevents the second iteration of the loop from failing.
* Fix successful decompress reported as Error::Read
- Add unit tests for raw deflate that illustrates the decompression failure when there are extra trailing bytes1 parent 52d8dd4 commit ee62523
2 files changed
+54
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3384 | 3384 | | |
3385 | 3385 | | |
3386 | 3386 | | |
3387 | | - | |
| 3387 | + | |
3388 | 3388 | | |
3389 | 3389 | | |
3390 | 3390 | | |
3391 | | - | |
3392 | | - | |
3393 | 3391 | | |
3394 | 3392 | | |
3395 | | - | |
3396 | | - | |
3397 | 3393 | | |
3398 | 3394 | | |
3399 | 3395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3330 | 3330 | | |
3331 | 3331 | | |
3332 | 3332 | | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
3333 | 3386 | | |
3334 | 3387 | | |
3335 | 3388 | | |
| |||
0 commit comments