1 Star 0 Fork 17

programmer12/jasper

forked from src-openEuler/jasper 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2021-27845.patch 841 Bytes
一键复制 编辑 原始数据 按行查看 历史
programmer12 提交于 2021-09-08 15:26 . fix CVE-2021-27845
From fd564ee3377d9fc2484c657e4f464a3fb9764d31 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Mon, 29 Jun 2020 13:47:09 +0200
Subject: [PATCH] jpc_enc: validate raw_size, prevent division by zero in
cp_create()
Closes https://github.com/mdadams/jasper/issues/194 (part 1)
---
src/libjasper/jpc/jpc_enc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libjasper/jpc/jpc_enc.c b/src/libjasper/jpc/jpc_enc.c
index d60a4471..3b6b1e81 100644
--- a/src/libjasper/jpc/jpc_enc.c
+++ b/src/libjasper/jpc/jpc_enc.c
@@ -428,6 +428,10 @@ static jpc_enc_cp_t *cp_create(const char *optstr, jas_image_t *image)
}
cp->rawsize = jas_image_rawsize(image);
+ if (cp->rawsize == 0) {
+ /* prevent division by zero in cp_create() */
+ goto error;
+ }
cp->totalsize = UINT_FAST32_MAX;
tcp = &cp->tcp;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/programmer12/jasper.git
git@gitee.com:programmer12/jasper.git
programmer12
jasper
jasper
master

搜索帮助