From 10ce9358230670c91caeab39c7ae7bb099229046 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sat, 30 Mar 2019 18:19:41 +0000 Subject: [PATCH] 3rdparty(zlib): prevent uninitialized use of state->check backporting of commit: 8afb2f0cb7a712d03dd58a2873fc449215df153d --- 3rdparty/zlib/inflate.c | 1 + .../20190330-ununitialized-use-state-check.diff | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 3rdparty/zlib/patches/20190330-ununitialized-use-state-check.diff diff --git a/3rdparty/zlib/inflate.c b/3rdparty/zlib/inflate.c index ac333e8c2e..19a2cf2ed8 100644 --- a/3rdparty/zlib/inflate.c +++ b/3rdparty/zlib/inflate.c @@ -228,6 +228,7 @@ int stream_size; state->strm = strm; state->window = Z_NULL; state->mode = HEAD; /* to pass state test in inflateReset2() */ + state->check = 1L; /* 1L is the result of adler32() zero length data */ ret = inflateReset2(strm, windowBits); if (ret != Z_OK) { ZFREE(strm, state); diff --git a/3rdparty/zlib/patches/20190330-ununitialized-use-state-check.diff b/3rdparty/zlib/patches/20190330-ununitialized-use-state-check.diff new file mode 100644 index 0000000000..6ecbde2d2c --- /dev/null +++ b/3rdparty/zlib/patches/20190330-ununitialized-use-state-check.diff @@ -0,0 +1,12 @@ +diff --git a/3rdparty/zlib/inflate.c b/3rdparty/zlib/inflate.c +index ac333e8c2e..19a2cf2ed8 100644 +--- a/3rdparty/zlib/inflate.c ++++ b/3rdparty/zlib/inflate.c +@@ -228,6 +228,7 @@ int stream_size; + state->strm = strm; + state->window = Z_NULL; + state->mode = HEAD; /* to pass state test in inflateReset2() */ ++ state->check = 1L; /* 1L is the result of adler32() zero length data */ + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state);