igzip: Fix underflow bugs whe null pointer is passed in igzip base functions

Change-Id: Ia24326dcde6f8be9ee019690b8206d2779ddebb2
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2017-03-13 15:32:57 -07:00 committed by Greg Tucker
parent 7c7272e89c
commit f2c35a9fd4
2 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
end_in = start_in + stream->avail_in;
next_in = start_in;
while (next_in < end_in - ISAL_LOOK_AHEAD) {
while (next_in + ISAL_LOOK_AHEAD < end_in) {
if (is_full(&state->bitbuf)) {
update_state(stream, start_in, next_in, end_in);
@ -125,7 +125,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
end_in = start_in + stream->avail_in;
next_in = start_in;
while (next_in < end_in - 3) {
while (next_in + 3 < end_in) {
if (is_full(&state->bitbuf)) {
update_state(stream, start_in, next_in, end_in);
return;

View File

@ -53,7 +53,7 @@ void isal_deflate_icf_body_base(struct isal_zstream *stream)
sizeof(struct deflate_icf);
next_out = start_out;
while (next_in < end_in - ISAL_LOOK_AHEAD) {
while (next_in + ISAL_LOOK_AHEAD < end_in) {
if (next_out >= end_out) {
state->state = ZSTATE_CREATE_HDR;
@ -140,7 +140,7 @@ void isal_deflate_icf_finish_base(struct isal_zstream *stream)
sizeof(struct deflate_icf);
next_out = start_out;
while (next_in < end_in - 3) {
while (next_in + 3 < end_in) {
if (next_out >= end_out) {
state->state = ZSTATE_CREATE_HDR;
update_state(stream, start_in, next_in, end_in, start_out, next_out,