shithub: jbig2

Download patch

ref: f32d81e74bc34f5cd823b6f12e302e37814b3546
parent: d474e9e990c9630076fc003691092017aac24326
author: Sebastian Rasmussen <sebras@gmail.com>
date: Wed May 23 23:28:04 EDT 2018

jbig2dec: Skip over undecoded pages when getting pages.

--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -308,14 +308,14 @@
             Jbig2Image *img = ctx->pages[index].image;
             uint32_t page_number = ctx->pages[index].number;
 
-            ctx->pages[index].state = JBIG2_PAGE_RETURNED;
-            if (img != NULL) {
-                jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "page %d returned to the client", page_number);
-                return jbig2_image_reference(ctx, img);
-            } else {
+            if (img == NULL) {
                 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "page %d returned with no associated image", page_number);
-                ;               /* continue */
+                continue;
             }
+
+            ctx->pages[index].state = JBIG2_PAGE_RETURNED;
+            jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "page %d returned to the client", page_number);
+            return jbig2_image_reference(ctx, img);
         }
     }