ref: 19dabb532ae37749fdb6c06447e2dfcf0e216e9b
parent: 2e9e3314b4264e547ce9372b4bcd2f20c50b5357
author: Ralph Giles <giles@snow.ghostscript.com>
date: Wed Jul 15 18:28:42 EDT 2009
Check for NULL before freeing metadata or symbol segment results. This protects against segfault during early termination.
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -134,7 +134,8 @@
brittle special casing */
switch (segment->flags & 63) {
case 0: /* symbol dictionary */
- jbig2_sd_release(ctx, segment->result);
+ if (segment->result != NULL)
+ jbig2_sd_release(ctx, segment->result);
break;
case 4: /* intermediate text region */
case 40: /* intermediate refinement region */
@@ -142,7 +143,8 @@
jbig2_image_release(ctx, segment->result);
break;
case 62:
- jbig2_metadata_free(ctx, segment->result);
+ if (segment->result != NULL)
+ jbig2_metadata_free(ctx, segment->result);
break;
default:
/* anything else is probably an undefined pointer */