diff --git a/fix-undefined-buffer-detected-by-oss-fuzz.patch b/fix-undefined-buffer-detected-by-oss-fuzz.patch new file mode 100644 index 0000000..5a94ce0 --- /dev/null +++ b/fix-undefined-buffer-detected-by-oss-fuzz.patch @@ -0,0 +1,30 @@ +From fbc28a919107bb6fbdceb2d3dfe610ddcbc5ac89 Mon Sep 17 00:00:00 2001 +From: fangyufa +Date: Tue, 3 Dec 2019 15:42:06 +0800 +Subject: [PATCH] zlib: fix undefined buffer detected by oss-fuzz + +this patch fixes a use of uninitialized value discovered by one of the +fuzzers of the oss-fuzz project: +https://github.com/google/oss-fuzz/blob/master/projects/zlib/example_dict_fuzzer.c +clear out s->prev buffer to avoid undefined behavior + +signed-off-by: fangyufa +--- + zlib-1.2.11/deflate.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/deflate.c b/deflate.c +index 4c42259..a03bef2 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -329,6 +329,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); ++ memset(s->prev, 0, s->w_size*sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ +-- +2.19.1 + diff --git a/zlib.spec b/zlib.spec index e0626d0..881c51c 100644 --- a/zlib.spec +++ b/zlib.spec @@ -1,6 +1,6 @@ Name: zlib Version: 1.2.11 -Release: 16 +Release: 17 Summary: A lossless data-compression library License: zlib and Boost URL: http://www.zlib.net @@ -16,6 +16,8 @@ Patch3: 0003-arm64-specific-build-patch.patch Patch4: 0004-zlib-Optimize-CRC32.patch %endif +Patch6000: fix-undefined-buffer-detected-by-oss-fuzz.patch + BuildRequires: automake, autoconf, libtool %description @@ -115,7 +117,11 @@ make test %{_libdir}/pkgconfig/minizip.pc %changelog +* Sat Dec 21 2019 openEuler Buildteam - 1.2.11-17 +- Fix undefined buffer detected by oss-fuzz + * Tue Dec 3 2019 liqiang - 1.2.11-16 - Optimize CRC32 by NEON + * Thu Sep 5 2019 dongjian - 1.2.11-15 - Rebuild the zlib and fix description