Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cherry-picked from: madler@e54e129

This is CVE-2016-9842 fix.
  • Loading branch information
azherebtsov authored and kornelski committed Oct 13, 2023
1 parent a3ba995 commit 47f1285
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,9 +1585,10 @@ int ZEXPORT inflateValidate(z_streamp strm, int check) {
long ZEXPORT inflateMark(z_streamp strm) {
struct inflate_state FAR *state;

if (inflateStateCheck(strm)) return ULONG_MAX << 16;
if (inflateStateCheck(strm))
return (long)(((unsigned long)0 - 1) << 16);
state = (struct inflate_state FAR *)strm->state;
return ((long)(state->back) << 16) +
return (long)(((unsigned long)((long)state->back)) << 16) +
(state->mode == COPY ? state->length :
(state->mode == MATCH ? state->was - state->length : 0));
}

0 comments on commit 47f1285

Please sign in to comment.