Fwd: Corrupt image when identify gif image
莫红波 <[email protected]> Fri, 9 Oct 2015 13:04:01 +0800
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <CACghtk1H8G28Cfz8cTGVF7OjmDLa2UqTbcXuSCGNSLBj=exxLw@mail.gmail.com> |
--===============0507451085857246287==
Content-Type: multipart/alternative; boundary=94eb2c0b80d86e1d0d0521a4e87d
--94eb2c0b80d86e1d0d0521a4e87d
Content-Type: text/plain; charset=UTF-8
The command:
gm identify test.gif
The output in terminal:
gm identify: Corrupt image (test.gif)
However, Imagemagicks does well.
So, I gdb GM and IM and then I found the difference.
In GM.1.3.22 coders/gif.c:
1011 if (opacity >= (long) image->colors)
1012 image->colors=opacity+1;
In IM:
1259 if (opacity >= (ssize_t) image->colors)
1260 opacity=(-1);
------
This difference will cause mistakes when allocating local colormaps.
Moreover I scaned spec-gif89a.txt
<http://www.w3.org/Graphics/GIF/spec-gif89a.txt> and didn't find anything
about this. So I'm not sure whether it's a bug.
image URL: http://bigfile.b0.upaiyun.com/test.gif
--94eb2c0b80d86e1d0d0521a4e87d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_quote"><br><div dir=3D"ltr">The comman=
d:<div>=C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 gm identify test.=
gif</div><div><br></div><div>The output in terminal:</div><div><br></div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 gm identify: Corrupt image (test.gif)<br></d=
iv><div><br></div><div>However, Imagemagicks does well.</div><div><br></div=
><div>So, I gdb GM and IM and then I found the difference.</div><div><br></=
div><div>In GM.1.3.22 coders/gif.c:</div><div><br></div><div><div>=C2=A0 =
=C2=A0 =C2=A01011 =C2=A0 =C2=A0 if (opacity >=3D (long) image->colors=
)</div><div>=C2=A0 =C2=A0 =C2=A01012 =C2=A0 =C2=A0 =C2=A0 image->colors=
=3Dopacity+1;</div></div><div><br></div><div>In IM:</div><div><br></div><di=
v>=C2=A0 =C2=A0 =C2=A01259 =C2=A0 =C2=A0 if (opacity >=3D (ssize_t) imag=
e->colors)</div><div>=C2=A0 =C2=A0 =C2=A01260 =C2=A0 =C2=A0 =C2=A0 opaci=
ty=3D(-1);</div><div><br></div><div>------</div><div><br></div><div>This di=
fference will cause mistakes when allocating local colormaps. Moreover I sc=
aned=C2=A0<a href=3D"http://www.w3.org/Graphics/GIF/spec-gif89a.txt" target=
=3D"_blank">spec-gif89a.txt</a>=C2=A0and didn't find anything about thi=
s. So I'm not sure whether it's a bug.</div><div><br></div><div><br=
></div><div>image URL: =C2=A0<a href=3D"http://bigfile.b0.upaiyun.com/test.=
gif">http://bigfile.b0.upaiyun.com/test.gif</a></div><div><br></div><div><b=
r></div><div><br></div><div><br></div><div><br></div><div><br></div><div><b=
r></div><div><br></div></div>
</div><br></div>
--94eb2c0b80d86e1d0d0521a4e87d--
--===============0507451085857246287==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
--===============0507451085857246287==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs
--===============0507451085857246287==--