Bug 687986, Incorrect code in HEAD spdiff.c

Alex Cherepanov <[email protected]> Sun, 27 Mar 2005 15:27:23 -0500
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Correctly read a big endian number from the unaligned buffer in
16 bit decoding pixel differencing filter.
Fix bug 687986.

DETAILS :
The same operation is done in the line 467. So the line 485
should be the same. This code has not been tested because I
don't know when Ghostscript executes it.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
687986.diff (text/plain, 562 B)
Index: gs/src/spdiff.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/spdiff.c,v
retrieving revision 1.9
diff -u -r1.9 spdiff.c
--- gs/src/spdiff.c	16 Mar 2005 14:57:42 -0000	1.9
+++ gs/src/spdiff.c	27 Mar 2005 19:07:52 -0000
@@ -482,7 +482,7 @@
 	    ss->prev[0] = s0;
 	    for (; count >= colors; count -= colors)
 		for (ci = 0; ci < colors; ++ci) {
-		    ti = *++p >> 8;
+		    ti = (int)*++p << 8;
 		    ss->prev[ci] += ti + *++p;
 		    *++q = ss->prev[ci] >> 8;
 		    *++q = ss->prev[ci] & 0xff;