shithub: jbig2

Download patch

ref: e84ccfbd79e935491a1420955be67af8dac9bc38
parent: 632bada9f1e04ff4c1391445c90d0eeed6fd3170
author: Sebastian Rasmussen <sebras@gmail.com>
date: Thu Feb 7 23:15:41 EST 2019

Use common pattern for error detection.

Previously the code used a non-standard variant, but it is better
to do error detection the same way everywhere.

--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -325,7 +325,7 @@
 
         code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[GSBPP - 1], GB_stats);
     }
-    if (code != 0) {
+    if (code < 0) {
         jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error decoding GSPLANES for halftone image");
         goto cleanup;
     }
@@ -341,7 +341,7 @@
         } else {
             code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[j], GB_stats);
         }
-        if (code != 0) {
+        if (code < 0) {
             jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode GSPLANES for halftone image");
             goto cleanup;
         }