Subject: zlib: Avoid shifts of negative values inflateMark
The C standard says that bit shifts of negative integers is
undefined. This casts to unsigned values to assure a known
result.
e54e129940
.patch
This commit is contained in:
parent
4b7144f763
commit
b807ccf261
1 changed files with 6 additions and 5 deletions
|
@ -1472,9 +1472,10 @@ z_streamp strm;
|
|||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
return ((long)(state->back) << 16) +
|
||||
(state->mode == COPY ? state->length :
|
||||
(state->mode == MATCH ? state->was - state->length : 0));
|
||||
if (strm == Z_NULL || strm->state == Z_NULL)
|
||||
return (long)(((unsigned long)0 - 1) << 16);
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
return (long)(((unsigned long)((long)state->back)) << 16) +
|
||||
(state->mode == COPY ? state->length :
|
||||
(state->mode == MATCH ? state->was - state->length : 0));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue