70a41d45b7
* zlib-bnc1003580.patch * zlib-bnc1013882.patch CVE-2016-9843 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zlib?expand=0&rev=35
30 lines
1.0 KiB
Diff
30 lines
1.0 KiB
Diff
From e54e1299404101a5a9d0cf5e45512b543967f958 Mon Sep 17 00:00:00 2001
|
|
From: Mark Adler <madler@alumni.caltech.edu>
|
|
Date: Sat, 5 Sep 2015 17:45:55 -0700
|
|
Subject: [PATCH] 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.
|
|
---
|
|
inflate.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/inflate.c b/inflate.c
|
|
index 2889e3a..a718416 100644
|
|
--- a/inflate.c
|
|
+++ b/inflate.c
|
|
@@ -1506,9 +1506,10 @@ z_streamp strm;
|
|
{
|
|
struct inflate_state FAR *state;
|
|
|
|
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
|
|
+ if (strm == Z_NULL || strm->state == Z_NULL)
|
|
+ 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));
|
|
}
|