poppler/JBIG2Stream.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
New commits: commit e950107006a3b1889646d3705323c1b3d41eaa49 Author: David Benjamin <[email protected]> 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 _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
