Skip to content
Snippets Groups Projects
Commit 2b280871 authored by Oliver Sander's avatar Oliver Sander
Browse files

JBIG2Stream: Do not abort if size-0 allocations returns nullptr

The JBIG2SymbolDict constructor gets a size parameter, and it allocates
memory for a bitmap of that size.  Bug report 535

  #535

has a file where this size is 0.  In that case, the call to
gmallocn_checkoverflow returns nullptr, and subsequent calls to
JBIG2SymbolDict::isOk return false.  This is then interpreted
as an error, and the JBIG2 processing is aborted.  For the
test file mentioned above this happens in line 1807.

I don't know whether such a file with a size-0 symbol dict
is malformed or not.  However, the test file renders just fine
if the 'failing' allocation is simply ignored.  This patch
therefore relaxes the isOk method a little.  A JBIG2SymbolDict
object is now deemed 'ok' either if it holds a bitmap (that was
the previous test) *or if it has size 0*.

This fixes

  #535
parent 571d8138
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment