Skip to content

Commit

Permalink
Fix DFLTCC not writing header bits when avail_out == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
iii-i authored and Dead2 committed Aug 21, 2020
1 parent 40acb3f commit ce409c6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arch/s390/dfltcc_deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,18 @@ int ZLIB_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *
send_eobs(strm, param);
param->bcf = 0;
dfltcc_state->block_threshold = strm->total_in + dfltcc_state->block_size;
if (strm->avail_out == 0) {
*result = need_more;
return 1;
}
}
}

/* No space for compressed data. If we proceed, dfltcc_cmpr() will return
* DFLTCC_CC_OP1_TOO_SHORT without buffering header bits, but we will still
* set BCF=1, which is wrong. Avoid complications and return early.
*/
if (strm->avail_out == 0) {
*result = need_more;
return 1;
}

/* The caller gave us too much data. Pass only one block worth of
* uncompressed data to DFLTCC and mask the rest, so that on the next
* iteration we start a new block.
Expand Down

0 comments on commit ce409c6

Please sign in to comment.