shithub: jbig2

Download patch

ref: 42c0312cc2855d2cc0d83954968c65a8e5e6107d
parent: 91496de8718924d6b112c093ea51894210ed8d3d
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Fri Dec 3 21:24:11 EST 2004

The gbat and grat content pixel offset arrays are signed.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@350 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -347,7 +347,7 @@
 					  as, image, GB_stats);
   else if (!params->MMR && params->GBTEMPLATE == 2)
     {
-      if (params->gbat[0] == 3 && params->gbat[1] == 255)
+      if (params->gbat[0] == 3 && params->gbat[1] == -1)
 	return jbig2_decode_generic_template2a(ctx, segment, params,
 					       as, image, GB_stats);
       else
--- a/jbig2_generic.h
+++ b/jbig2_generic.h
@@ -29,7 +29,7 @@
   bool TPGDON;
   bool USESKIP;
   /* SKIP */
-  byte gbat[8];
+  int8_t gbat[8];
 } Jbig2GenericRegionParams;
 
 int
@@ -49,7 +49,7 @@
   Jbig2Image *reference;
   int32_t DX, DY;
   bool TPGRON;
-  byte grat[4];
+  int8_t grat[4];
 } Jbig2RefinementRegionParams;
 
 int
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -356,10 +356,10 @@
     if (segment->data_length < 22)
       return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
                          "Segment too short");
-    params.grat[0] = (signed char)segment_data[offset + 0];
-    params.grat[1] = (signed char)segment_data[offset + 1];
-    params.grat[2] = (signed char)segment_data[offset + 2];
-    params.grat[3] = (signed char)segment_data[offset + 3];
+    params.grat[0] = segment_data[offset + 0];
+    params.grat[1] = segment_data[offset + 1];
+    params.grat[2] = segment_data[offset + 2];
+    params.grat[3] = segment_data[offset + 3];
     jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
                    "grat1: (%d, %d) grat2: (%d, %d)", 
                    params.grat[0], params.grat[1],