]> git.lizzy.rs Git - zlib.git/commitdiff
Avoid casting an out-of-range value to long.
authorMark Adler <madler@alumni.caltech.edu>
Wed, 12 Oct 2016 01:38:20 +0000 (18:38 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Wed, 12 Oct 2016 01:38:20 +0000 (18:38 -0700)
inflate.c

index 9ee84d07da4c06d7781d704671015bf028a89217..2f3fcc9aad1374b765eb0e90938abafb1a2ecdef 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -1526,7 +1526,7 @@ z_streamp strm;
     struct inflate_state FAR *state;
 
     if (strm == Z_NULL || strm->state == Z_NULL)
-        return (long)(((unsigned long)0 - 1) << 16);
+        return -(1L << 16);
     state = (struct inflate_state FAR *)strm->state;
     return (long)(((unsigned long)((long)state->back)) << 16) +
         (state->mode == COPY ? state->length :