]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Zlib patch: prevent uninitialized use of state->check
authorSebastian Pop <s.pop@samsung.com>
Wed, 12 Dec 2018 15:35:43 +0000 (09:35 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 13 Dec 2018 08:08:35 +0000 (09:08 +0100)
This CL fixes a security bug in zlib. It was reported upstream long ago
and the testcase was shared upstream but it's yet unsolved. As a fix,
state->check is set to the same value as the adler32 of an empty string.

Upstream bug: madler/zlib#245

Bug: chromium:697481 https://crbug.com/697481
Reviewed-on: https://chromium-review.googlesource.com/601193
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Adam Langley <agl@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>

inflate.c

index 469dde6e2588b040300a8bda471b6acb139d60e7..cb84adb6d1b1ff4558fc1d4d7824693c28fe7ad2 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -124,6 +124,7 @@ int ZEXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
     if (state->wrap)        /* to support ill-conceived Java test suite */
         strm->adler = state->wrap & 1;
     state->mode = HEAD;
+    state->check = functable.adler32(0L, NULL, 0);
     state->last = 0;
     state->havedict = 0;
     state->dmax = 32768U;