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 (closed) 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.
Fixes: #535 (closed)