1 Star 0 Fork 17

zhangxingrong/jasper

forked from src-openEuler/jasper 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fixed-a-potential-integer-overflow-problem-in-the.patch 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-07-08 18:37 . add some upstream patchs
From 2bd1657c07e9815b89d0553c782b841d11630580 Mon Sep 17 00:00:00 2001
From: Michael Adams <mdadams@ece.uvic.ca>
Date: Fri, 1 Dec 2023 09:27:08 -0800
Subject: [PATCH] Fixed a potential integer overflow problem in the
jas_safeui32_to_intfast32 function.
---
src/libjasper/include/jasper/jas_math.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libjasper/include/jasper/jas_math.h b/src/libjasper/include/jasper/jas_math.h
index 17c07116..6df20412 100644
--- a/src/libjasper/include/jasper/jas_math.h
+++ b/src/libjasper/include/jasper/jas_math.h
@@ -407,7 +407,7 @@ inline static bool jas_safe_uint_mul(unsigned x, unsigned y, unsigned *result)
* Safe 32-bit unsigned integer arithmetic (i.e., with overflow checking).
\******************************************************************************/
-#define JAS_SAFEUI32_MAX (0xffffffffU)
+#define JAS_SAFEUI32_MAX (0xffffffffUL)
typedef struct {
bool valid;
@@ -432,7 +432,8 @@ JAS_ATTRIBUTE_PURE
static inline bool jas_safeui32_to_intfast32(jas_safeui32_t x,
int_fast32_t* y)
{
- if (x.value <= INT_FAST32_MAX) {
+ const long I32_MAX = 0x7fffffffL;
+ if (x.value <= I32_MAX) {
*y = x.value;
return true;
} else {
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxingrong/jasper.git
git@gitee.com:zhangxingrong/jasper.git
zhangxingrong
jasper
jasper
master

搜索帮助