Comment 2 for bug 321561

Revision history for this message
In , David Benjamin (davidben) wrote :

Created an attachment (id=26981)
Fixes DecryptStream::getPos()

This patch appears to fix the bug.

The problem is that JBIG2Stream uses the Stream::getPos() of wrapped streams to determine segment length, specifically whether too many or too few characters have been read. A LOT of streams don't provide sane values and this trips up JBIG2Stream. (Notably ones that subclass FilterStream. FilterStream provides a default implementation of getPos() which is often wrong. It only works if the Filter does not blow up or shrink the data, i.e. there is one and only one call to str->readChar() for every call to readChar().)

The culprit in this case was DecryptStream.