File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,7 @@ cdef class Decompress:
410
410
cdef unsigned long prev_avail_out
411
411
cdef unsigned long bytes_written
412
412
cdef int err
413
+ cdef bint last_round = 0
413
414
# This loop reads all the input bytes. If there are no input bytes
414
415
# anymore the output is written.
415
416
while (self .stream.avail_out == 0
@@ -420,6 +421,9 @@ cdef class Decompress:
420
421
break
421
422
elif total_bytes + self .obuflen >= max_length:
422
423
self .stream.avail_out = max_length - total_bytes
424
+ # The inflate process may not fill all available bytes so
425
+ # we make sure this is the last round.
426
+ last_round = 1
423
427
else :
424
428
self .stream.avail_out = self .obuflen
425
429
prev_avail_out = self .stream.avail_out
@@ -432,7 +436,7 @@ cdef class Decompress:
432
436
bytes_written = prev_avail_out - self .stream.avail_out
433
437
total_bytes += bytes_written
434
438
out.append(self .obuf[:bytes_written])
435
- if self .stream.block_state == ISAL_BLOCK_FINISH:
439
+ if self .stream.block_state == ISAL_BLOCK_FINISH or last_round :
436
440
break
437
441
# Save unconsumed input implementation from zlibmodule.c
438
442
if self .stream.block_state == ISAL_BLOCK_FINISH:
You can’t perform that action at this time.
0 commit comments