shithub: jbig2

Download patch

ref: 35d45096bf79e58948d41c6c54095b71ea906a26
parent: a16f29153ec28068152c104aa9d6b455d6829f46
author: Alex Cherepanov <alex.cherepanov@artifex.com>
date: Mon Jan 28 11:34:20 EST 2013

Bug 693284: Detect missing glyphs and fail.


--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -607,6 +607,13 @@
 		      rparams.reference = (ID < ninsyms) ?
 					params->SDINSYMS->glyphs[ID] :
 					SDNEWSYMS->glyphs[ID-ninsyms];
+		      /* SumatraPDF: fail on missing glyphs */
+		      if (rparams.reference == NULL) {
+		          code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+		              "missing glyph %d/%d!", ID, ninsyms);
+		          jbig2_image_release(ctx, image);
+		          goto cleanup4;
+		      }
 		      rparams.DX = RDX;
 		      rparams.DY = RDY;
 		      rparams.TPGRON = 0;
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -302,6 +302,12 @@
 		while (id >= dicts[index]->n_symbols)
 		    id -= dicts[index++]->n_symbols;
 		IB = jbig2_image_clone(ctx, dicts[index]->glyphs[id]);
+		/* SumatraPDF: fail on missing glyphs */
+		if (!IB) {
+		    code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+		        "missing glyph %d/%d!", index, id);
+		    goto cleanup2;
+		}
 	    }
 	    if (params->SBREFINE) {
 	      if (params->SBHUFF) {