igzip: Fix Stateless Full Flush type0 block bugs

Prevent type 0 block in stateless full flush from attempting to write a trailer
when it not the end of the stream and fix the values of block_start and
block_end.

Change-Id: Ia8beac20fc244b1b3e5690cbc15d4d4bb8ada68e
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2018-07-31 19:51:22 -04:00
parent a1f8e55d11
commit 49e3329729

View File

@ -1316,10 +1316,10 @@ int isal_deflate_stateless(struct isal_zstream *stream)
stream->next_in = next_in + avail_in; stream->next_in = next_in + avail_in;
stream->avail_in = 0; stream->avail_in = 0;
stream->total_in = total_in + avail_in; stream->total_in = avail_in;
state->block_next = 0; state->block_next = stream->total_in - avail_in;
state->block_end = avail_in; state->block_end = stream->total_in;
stream->next_out = next_out; stream->next_out = next_out;
stream->avail_out = avail_out; stream->avail_out = avail_out;
@ -1337,12 +1337,16 @@ int isal_deflate_stateless(struct isal_zstream *stream)
write_stored_block(stream); write_stored_block(stream);
stream->total_in = total_in + avail_in;
if (stream->gzip_flag) { if (stream->gzip_flag) {
stream->internal_state.crc = 0; stream->internal_state.crc = 0;
update_checksum(stream, next_in, avail_in); update_checksum(stream, next_in, avail_in);
} }
write_trailer(stream); if (stream->end_of_stream)
write_trailer(stream);
return COMP_OK; return COMP_OK;
} }