shithub: jbig2

Download patch

ref: eb7f46063eb1b3e220c13839ef622c29bcf5834f
parent: 99672eb6ce4dad97c3ff22f9768b0073f730331e
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Dec 23 07:53:49 EST 2004

Properly mask the last row byte in the shift == 0 compositor 
case. Fixes bug 687843.


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

--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,9 @@
 Version 0.8 (unreleased)
 
- * properly handle non-OR image composition operators
  * Fix an allocation error in the page array
+ * properly handle non-OR image composition operators
+ * Fix a UMR bug in the compositor
+ * successfully decodes ubc test streams 042_12,15,16,17,18
 
 Version 0.7 (2004 December 8)
 
@@ -9,7 +11,7 @@
  * refinement region handling
  * successfully decodes ubc test streams 042_21, 042_22 and 042_23
  * generic region template 3 handling with arbitrary AT locations
- * successfully decodes ubc test stream 042_6 and 042_7
+ * successfully decodes ubc test streams 042_6 and 042_7
  
 Version 0.6 (2003 December 31)
 
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -198,9 +198,11 @@
             s += src->stride;
         }
     } else if (shift == 0) {
+	rightmask = (w & 7) ? 0x100 - (1 << (8 - (w & 7))) : 0xFF;
         for (j = 0; j < h; j++) {
-	    for (i = leftbyte; i <= rightbyte; i++)
+	    for (i = leftbyte; i < rightbyte; i++)
 		*d++ |= *s++;
+	    *d |= *s & rightmask;
             d = (dd += dst->stride);
             s = (ss += src->stride);
 	}