shithub: jbig2

Download patch

ref: 3410c34a5320765a4f7fd5c8bf4dd6f54bf99c9a
parent: 7be48b493cfc60bc1eaa637ead0fb2c369b03c19
author: Sebastian Rasmussen <sebras@gmail.com>
date: Thu Sep 20 16:24:47 EDT 2018

jbig2dec: Fix signed/unsigned mismatches.

--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -380,7 +380,7 @@
         uint32_t CONTEXT;
         uint32_t line_m1;
         uint32_t line_m2;
-        int padded_width = (GBW + 7) & -8;
+        uint32_t padded_width = (GBW + 7) & -8;
         int code = 0;
 
         line_m1 = line1 ? line1[0] : 0;
@@ -550,7 +550,7 @@
         uint32_t CONTEXT;
         uint32_t line_m1;
         uint32_t line_m2;
-        int padded_width = (GBW + 7) & -8;
+        uint32_t padded_width = (GBW + 7) & -8;
 
         line_m1 = line1 ? line1[0] : 0;
         line_m2 = line2 ? line2[0] << 5 : 0;
@@ -661,7 +661,7 @@
         uint32_t CONTEXT;
         uint32_t line_m1;
         uint32_t line_m2;
-        int padded_width = (GBW + 7) & -8;
+        uint32_t padded_width = (GBW + 7) & -8;
 
         line_m1 = line1 ? line1[0] : 0;
         line_m2 = line2 ? line2[0] << 4 : 0;
@@ -725,7 +725,7 @@
     for (y = 0; y < GBH; y++) {
         uint32_t CONTEXT;
         uint32_t line_m1;
-        int padded_width = (GBW + 7) & -8;
+        uint32_t padded_width = (GBW + 7) & -8;
 
         line_m1 = line1 ? line1[0] : 0;
         CONTEXT = (line_m1 >> 1) & 0x3f0;
--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -47,7 +47,7 @@
     const uint32_t HPW = params->HDPW;
     const uint32_t HPH = params->HDPH;
     int code;
-    int i;
+    uint32_t i;
     int j;
 
     /* allocate a new struct */
@@ -76,7 +76,7 @@
             /* compose with the REPLACE operator; the source
                will be clipped to the destination, selecting the
                proper sub image */
-            code = jbig2_image_compose(ctx, new->patterns[i], image, -i * HPW, 0, JBIG2_COMPOSE_REPLACE);
+            code = jbig2_image_compose(ctx, new->patterns[i], image, -i * (int32_t) HPW, 0, JBIG2_COMPOSE_REPLACE);
             if (code < 0) {
                 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to compose image into collective bitmap dictionary");
                 for (j = 0; j < i; j++)
@@ -458,7 +458,7 @@
     Jbig2Image *HSKIP = NULL;
     Jbig2PatternDict *HPATS;
     uint32_t i;
-    int32_t mg, ng;
+    uint32_t mg, ng;
     int32_t x, y;
     uint16_t gray_val;
     int code = 0;