xref: /aosp_15_r20/external/zlib/patches/0002-uninitializedcheck.patch (revision 86ee64e75fa5f8bce2c8c356138035642429cd05)
1*86ee64e7SAndroid Build Coastguard WorkerFrom 1a03e7aec95d89c659fd91f195b99893b6458cd7 Mon Sep 17 00:00:00 2001
2*86ee64e7SAndroid Build Coastguard WorkerFrom: Adenilson Cavalcanti <[email protected]>
3*86ee64e7SAndroid Build Coastguard WorkerDate: Wed, 27 Sep 2017 13:59:04 -0700
4*86ee64e7SAndroid Build Coastguard WorkerSubject: [PATCH] Zlib patch: prevent uninitialized use of state->check
5*86ee64e7SAndroid Build Coastguard Worker
6*86ee64e7SAndroid Build Coastguard WorkerNo need to call the Adler32 checksum function, just set
7*86ee64e7SAndroid Build Coastguard Workerthe struct field to the expected value.
8*86ee64e7SAndroid Build Coastguard Worker
9*86ee64e7SAndroid Build Coastguard WorkerUpstream bug: madler/zlib#245
10*86ee64e7SAndroid Build Coastguard Worker---
11*86ee64e7SAndroid Build Coastguard Worker third_party/zlib/inflate.c                             |  2 +-
12*86ee64e7SAndroid Build Coastguard Worker 1 files changed, 1 insertion(+), 1 deletions(-)
13*86ee64e7SAndroid Build Coastguard Worker delete mode 100644 third_party/zlib/patches/0002-uninitializedcheck.patch
14*86ee64e7SAndroid Build Coastguard Worker
15*86ee64e7SAndroid Build Coastguard Workerdiff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c
16*86ee64e7SAndroid Build Coastguard Workerindex bec9497..5c40cf1 100644
17*86ee64e7SAndroid Build Coastguard Worker--- a/third_party/zlib/inflate.c
18*86ee64e7SAndroid Build Coastguard Worker+++ b/third_party/zlib/inflate.c
19*86ee64e7SAndroid Build Coastguard Worker@@ -228,7 +228,7 @@ int stream_size;
20*86ee64e7SAndroid Build Coastguard Worker     state->strm = strm;
21*86ee64e7SAndroid Build Coastguard Worker     state->window = Z_NULL;
22*86ee64e7SAndroid Build Coastguard Worker     state->mode = HEAD;     /* to pass state test in inflateReset2() */
23*86ee64e7SAndroid Build Coastguard Worker-    state->check = adler32(0L, Z_NULL, 0);
24*86ee64e7SAndroid Build Coastguard Worker+    state->check = 1L;      /* 1L is the result of adler32() zero length data */
25*86ee64e7SAndroid Build Coastguard Worker     ret = inflateReset2(strm, windowBits);
26*86ee64e7SAndroid Build Coastguard Worker     if (ret != Z_OK) {
27*86ee64e7SAndroid Build Coastguard Worker         ZFREE(strm, state);
28