30 lines
1.2 KiB
Diff
30 lines
1.2 KiB
Diff
From d8efdc261ea40e3b3af82ed1d9bc7bcdafa36d67 Mon Sep 17 00:00:00 2001
|
|
From: Albert Astals Cid @tsdgeos
|
|
Date: Tue, 6 Sep 2022 14:35:28 +0800
|
|
Subject: [PATCH] JBIG2Stream: Fix crash on broken file
|
|
|
|
---
|
|
poppler/JBIG2Stream.cc | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
|
|
index 9eddaa6..cb5cf2c 100644
|
|
--- a/poppler/JBIG2Stream.cc
|
|
+++ b/poppler/JBIG2Stream.cc
|
|
@@ -1968,7 +1968,11 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless
|
|
for (i = 0; i < nRefSegs; ++i) {
|
|
if ((seg = findSegment(refSegs[i]))) {
|
|
if (seg->getType() == jbig2SegSymbolDict) {
|
|
- numSyms += ((JBIG2SymbolDict *)seg)->getSize();
|
|
+ const unsigned int segSize = ((JBIG2SymbolDict *)seg)->getSize();
|
|
+ if (unlikely(checkedAdd(numSyms, segSize, &numSyms))) {
|
|
+ error(errSyntaxError, getPos(), "Too many symbols in JBIG2 text region");
|
|
+ return;
|
|
+ }
|
|
} else if (seg->getType() == jbig2SegCodeTable) {
|
|
codeTables.push_back(seg);
|
|
}
|
|
--
|
|
2.33.0
|
|
|