1 Star 0 Fork 32

xu_ping/zlib

forked from src-openEuler/zlib 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix-undefined-buffer-detected-by-oss-fuzz.patch 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-25 16:11 . Package init
From fbc28a919107bb6fbdceb2d3dfe610ddcbc5ac89 Mon Sep 17 00:00:00 2001
From: fangyufa <fangyufa1@huawei.com>
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 <fangyufa1@huawei.com>
---
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cherry530/zlib.git
git@gitee.com:cherry530/zlib.git
cherry530
zlib
zlib
master

搜索帮助