mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
- #41630, fix segfault when an invalid color index is present in the image
data
This commit is contained in:
parent
b1a0a4d3e4
commit
c4b5196d0b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user