shithub: jbig2

Download patch

ref: 1e7548319ce2b839caf138099759d39323122d25
parent: 471dabc8b157f9a841e4f0090e3c2ff016915fd9
author: Sebastian Rasmussen <[email protected]>
date: Sun Apr 8 10:58:23 EDT 2018

jbig2dec: Plug leak of image upon error decoding text region.

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -514,7 +514,10 @@
                         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)
+                        {
+                            jbig2_image_release(ctx, image);
                             goto cleanup4;
+                        }
 
                         SDNEWSYMS->glyphs[NSYMSDECODED] = image;
                         refagg_dicts[0]->glyphs[params->SDNUMINSYMS + NSYMSDECODED] = jbig2_image_clone(ctx, SDNEWSYMS->glyphs[NSYMSDECODED]);