VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/zlib/infback.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/zlib/infback.c')
-rw-r--r--src/Common/zlib/infback.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Common/zlib/infback.c b/src/Common/zlib/infback.c
index a390c58e..babeaf18 100644
--- a/src/Common/zlib/infback.c
+++ b/src/Common/zlib/infback.c
@@ -66,6 +66,7 @@ int stream_size;
state->window = window;
state->wnext = 0;
state->whave = 0;
+ state->sane = 1;
return Z_OK;
}
@@ -605,25 +606,27 @@ void FAR *out_desc;
break;
case DONE:
- /* inflate stream terminated properly -- write leftover output */
+ /* inflate stream terminated properly */
ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
goto inf_leave;
case BAD:
ret = Z_DATA_ERROR;
goto inf_leave;
- default: /* can't happen, but makes compilers happy */
+ default:
+ /* can't happen, but makes compilers happy */
ret = Z_STREAM_ERROR;
goto inf_leave;
}
- /* Return unused input */
+ /* Write leftover output and return unused input */
inf_leave:
+ if (left < state->wsize) {
+ if (out(out_desc, state->window, state->wsize - left) &&
+ ret == Z_STREAM_END)
+ ret = Z_BUF_ERROR;
+ }
strm->next_in = next;
strm->avail_in = have;
return ret;