shithub: jbig2

Download patch

ref: e1a691ca498dd4aa4808b94edfb9b3448ca7ed51
parent: 8ef46b5d3b5461bd1fe09a00aca8beddfb48ec25
author: Sebastian Rasmussen <sebras@gmail.com>
date: Fri Aug 3 08:28:23 EDT 2018

jbig2dec: Initialize entire page structure upon allocation.

Without this uninitialized values in the page structure will be
used when parsing segments. An example of this is in
jbig2_immediate_generic_region() when a the height of the page is
used to determine if the region is outside of the page.

--- a/jbig2.c
+++ b/jbig2.c
@@ -150,6 +150,14 @@
         for (index = 0; index < result->max_page_index; index++) {
             result->pages[index].state = JBIG2_PAGE_FREE;
             result->pages[index].number = 0;
+            result->pages[index].width = 0;
+            result->pages[index].height = 0xffffffff;
+            result->pages[index].x_resolution = 0;
+            result->pages[index].y_resolution = 0;
+            result->pages[index].stripe_size = 0;
+            result->pages[index].striped = 0;
+            result->pages[index].end_row = 0;
+            result->pages[index].flags = 0;
             result->pages[index].image = NULL;
         }
     }