- #41630, fix segfault when an invalid color index is present in the image

data
This commit is contained in:
Pierre Joye 2007-06-07 21:07:33 +00:00
parent b1a0a4d3e4
commit c4b5196d0b

View File

@ -586,7 +586,10 @@ ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)
/* return; */
/*} */
while ((v = LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP)) >= 0 ) {
while ((v = LWZReadByte(fd, &sd, FALSE, c, ZeroDataBlockP)) >= 0) {
if (v >= gdMaxColors) {
v = 0;
}
/* This how we recognize which colors are actually used. */
if (im->open[v]) {
im->open[v] = 0;