1 Star 0 Fork 9

wang_yue111/libpng12

forked from src-openEuler/libpng12 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2013-7353-1.patch 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
From 1a3d6e3cf3082a0da998dbf402d384a589488859 Mon Sep 17 00:00:00 2001
From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
Date: Thu, 10 Jan 2013 09:24:03 -0600
Subject: [PATCH] [libpng15] Check validity of "num_unknowns" parameter
of png_set_unknown_chunks().
---
pngset.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/pngset.c b/pngset.c
index 5472d46..94e5c92 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1024,9 +1024,17 @@ png_set_unknown_chunks(png_structp png_ptr,
if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
return;
- np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
- (png_uint_32)((info_ptr->unknown_chunks_num + num_unknowns) *
- png_sizeof(png_unknown_chunk)));
+ if (num_unknowns < 0 ||
+ num_unknowns >= UINT_MAX-info_ptr->unknown_chunks_num ||
+ num_unknowns >= PNG_SIZE_MAX/png_sizeof(png_unknown_chunk)
+ - info_ptr->unknown_chunks_num)
+ np=NULL;
+
+ else
+ np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
+ (png_uint_32)(info_ptr->unknown_chunks_num + num_unknowns) *
+ png_sizeof(png_unknown_chunk));
+
if (np == NULL)
{
png_warning(png_ptr,
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang_yue111/libpng12.git
[email protected]:wang_yue111/libpng12.git
wang_yue111
libpng12
libpng12
master

搜索帮助