代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/ghostscript 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ea9b3a676a516a603fabb593085d14a67356db6f Mon Sep 17 00:00:00 2001
From: Sebastian Rasmussen <sebras@gmail.com>
Date: Thu, 17 Oct 2019 01:48:00 +0200
Subject: [PATCH] Bug 701721: jbig2dec: Fix under/overflow handling in
arithmetic integer decoder.
The previous detection logic caused GCC's -Wlogical-op to trip.
Not only that, but the detection logic never took into account
that underflow is not possible (the worst case is V == INT32_MIN,
but offset is always > 0, so underflow cannot happen), nor take
varying offset values into account (hardcoded limits meant that
the offset was ignored even if it could not cause an overflow),
but instead could cause non-clamped values to be emitted.
This corrected logic adheres to the Annex A. Table A.1 in the specification.
---
jbig2dec/jbig2_arith_int.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/jbig2dec/jbig2_arith_int.c b/jbig2dec/jbig2_arith_int.c
index 7ad47ad..20b62df 100644
--- a/jbig2dec/jbig2_arith_int.c
+++ b/jbig2dec/jbig2_arith_int.c
@@ -130,8 +130,11 @@ jbig2_arith_int_decode(Jbig2Ctx *ctx, Jbig2ArithIntCtx *actx, Jbig2ArithState *a
V = (V << 1) | bit;
}
- /* make sure not to underflow/overflow 32 bit value */
- if (V < INT32_MAX - 4436 || V > INT32_MIN + 4436)
+ /* offset is always >=0, so underflow can't happen. */
+ /* avoid overflow by clamping 32 bit value. */
+ if (V > INT32_MAX - offset)
+ V = INT32_MAX;
+ else
V += offset;
V = S ? -V : V;
*p_result = V;
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。