Re: Bug 687986, Incorrect code in HEAD spdiff.c |
Ray Johnston <[email protected]> Sun, 27 Mar 2005 22:36:11 -0800
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Alex,
Please make the cast more evident (even if it compiles to the
same thing):
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;
- ss->prev[ci] += ti + *++p;
+ ti = (int)(*++p) << 8;
+ ss->prev[ci] += ti + (int)(*++p);
*++q = ss->prev[ci] >> 8;
*++q = ss->prev[ci] & 0xff;
If you agree that this is equivalent to the intent fo your patch,
please commit.
I recall that this code would be executed by the PDF interpreter when
it imports a PDF that has a 16 bit deep image (at least under some
subset conditions). I don't have a test file handy, but I think Dan
Coby may have created a couple with newer PhotoShop or Illustrator.
Regards,
Ray
_____________________________________________________________________
Alex Cherepanov wrote:
> 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.
>
>
> ------------------------------------------------------------------------
>
> 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;
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review