11cb0ef41Sopenharmony_ciFrom 1a03e7aec95d89c659fd91f195b99893b6458cd7 Mon Sep 17 00:00:00 2001
21cb0ef41Sopenharmony_ciFrom: Adenilson Cavalcanti <adenilson.cavalcanti@arm.com>
31cb0ef41Sopenharmony_ciDate: Wed, 27 Sep 2017 13:59:04 -0700
41cb0ef41Sopenharmony_ciSubject: [PATCH] Zlib patch: prevent uninitialized use of state->check
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciNo need to call the Adler32 checksum function, just set
71cb0ef41Sopenharmony_cithe struct field to the expected value.
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciUpstream bug: madler/zlib#245
101cb0ef41Sopenharmony_ci---
111cb0ef41Sopenharmony_ci third_party/zlib/inflate.c                             |  2 +-
121cb0ef41Sopenharmony_ci 1 files changed, 1 insertion(+), 1 deletions(-)
131cb0ef41Sopenharmony_ci delete mode 100644 third_party/zlib/patches/0002-uninitializedcheck.patch
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cidiff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c
161cb0ef41Sopenharmony_ciindex bec9497..5c40cf1 100644
171cb0ef41Sopenharmony_ci--- a/third_party/zlib/inflate.c
181cb0ef41Sopenharmony_ci+++ b/third_party/zlib/inflate.c
191cb0ef41Sopenharmony_ci@@ -228,7 +228,7 @@ int stream_size;
201cb0ef41Sopenharmony_ci     state->strm = strm;
211cb0ef41Sopenharmony_ci     state->window = Z_NULL;
221cb0ef41Sopenharmony_ci     state->mode = HEAD;     /* to pass state test in inflateReset2() */
231cb0ef41Sopenharmony_ci-    state->check = adler32(0L, Z_NULL, 0);
241cb0ef41Sopenharmony_ci+    state->check = 1L;      /* 1L is the result of adler32() zero length data */
251cb0ef41Sopenharmony_ci     ret = inflateReset2(strm, windowBits);
261cb0ef41Sopenharmony_ci     if (ret != Z_OK) {
271cb0ef41Sopenharmony_ci         ZFREE(strm, state);
28