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