shithub: jbig2

Download patch

ref: 377f4d5732ac0fd81402b58f7d65a035904577cf
parent: b6c58d62f2a0b4af079622afad099a06f045ab1a
author: Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
date: Wed May 24 15:29:57 EDT 2017

Bug 697934: Fix SEGV due to error code being ignored.

The return code from jbig2_decode_text_region was being ignored so the
code continued to try and parse the invalid file using incomplete/empty
structures.

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -493,8 +493,10 @@
                         }
 
                         /* multiple symbols are handled as a text region */
-                        jbig2_decode_text_region(ctx, segment, tparams, (const Jbig2SymbolDict * const *)refagg_dicts,
+                        code = jbig2_decode_text_region(ctx, segment, tparams, (const Jbig2SymbolDict * const *)refagg_dicts,
                                                  n_refagg_dicts, image, data, size, GR_stats, as, ws);
+                        if (code < 0)
+                            goto cleanup4;
 
                         SDNEWSYMS->glyphs[NSYMSDECODED] = image;
                         refagg_dicts[0]->glyphs[params->SDNUMINSYMS + NSYMSDECODED] = jbig2_image_clone(ctx, SDNEWSYMS->glyphs[NSYMSDECODED]);