shithub: jbig2

Download patch

ref: 561503c2355cae3619c03c9957758eed3848b343
parent: b009e994db066f204f85cb7935ebd5e7a0e1cb6c
author: Robin Watts <robin@peeves.(none)>
date: Fri Oct 4 04:17:40 EDT 2013

Bug 694249: Fix JBig2Dec using broken image regions.

When decoding a "generic immediate region" in jbig2dec, if
we detect an error, we should not use the image as it may not
have been entirely initialised.

--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -909,8 +909,12 @@
 					 as, image, GB_stats);
     }
 
-  jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page],
-			image, rsi.x, rsi.y, rsi.op);
+  if (code >= 0)
+    jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page],
+			  image, rsi.x, rsi.y, rsi.op);
+  else
+    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+		"error while decoding immediate_generic_region");
 
 cleanup:
   jbig2_free(ctx->allocator, as);