[poppler] poppler/JBIG2Stream.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Sep 8 16:22:03 PDT 2009
poppler/JBIG2Stream.cc | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit e950107006a3b1889646d3705323c1b3d41eaa49
Author: David Benjamin <davidben at mit.edu>
Date: Wed Sep 9 01:19:38 2009 +0200
Fix infinite loop in JBIG2Decoder
Bug 23025
Also fixes problems in bug-poppler6881-2.pdf and bug-poppler6500.pdf
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index fec0e2d..97994bd 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1587,12 +1587,15 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length,
goto eofError;
}
- // compute symbol code length
+ // compute symbol code length, per 6.5.8.2.3
+ // symCodeLen = ceil( log2( numInputSyms + numNewSyms ) )
symCodeLen = 1;
- i = (numInputSyms + numNewSyms) >> 1;
- while (i) {
- ++symCodeLen;
- i >>= 1;
+ if (likely(numInputSyms + numNewSyms > 0)) { // don't fail too badly if the sum is 0
+ i = (numInputSyms + numNewSyms - 1) >> 1;
+ while (i) {
+ ++symCodeLen;
+ i >>= 1;
+ }
}
// get the input symbol bitmaps
More information about the poppler
mailing list