summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2007-04-04 11:40:11 +0000
committerPierre Joye <pajoye@php.net>2007-04-04 11:40:11 +0000
commit539be2cc816d4e12950594458d4e012c5650cc51 (patch)
tree41ac8e64d2ad96ee374eb47a15930568b3b0385d /ext/gd
parente07b83afb2d873b4e2b76b84d41ec4c2b685eab4 (diff)
downloadphp-git-539be2cc816d4e12950594458d4e012c5650cc51.tar.gz
- do not try to use the global color map when none was found (Nuno, Pierre)
- free im on error
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/libgd/gd_gif_in.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c
index 16ccc796c1..8ee77b02e8 100644
--- a/ext/gd/libgd/gd_gif_in.c
+++ b/ext/gd/libgd/gd_gif_in.c
@@ -142,7 +142,7 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
/*1.4//int imageCount = 0; */
int ZeroDataBlock = FALSE;
-
+ int haveGlobalColormap;
gdImagePtr im = 0;
/*1.4//imageNumber = 1; */
@@ -174,11 +174,13 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
screen_width = imw = LM_to_uint(buf[0],buf[1]);
screen_height = imh = LM_to_uint(buf[2],buf[3]);
- if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
+ haveGlobalColormap = BitSet(buf[4], LOCALCOLORMAP); /* Global Colormap */
+ if (haveGlobalColormap) {
if (ReadColorMap(fd, BitPixel, ColorMap)) {
return 0;
}
}
+
for (;;) {
int top, left;
int width, height;
@@ -227,13 +229,18 @@ gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */
return 0;
}
im->interlace = BitSet(buf[8], INTERLACE);
- if (! useGlobalColormap) {
+ if (!useGlobalColormap) {
if (ReadColorMap(fd, bitPixel, localColorMap)) {
+ gdImageDestroy(im);
return 0;
}
ReadImage(im, fd, width, height, localColorMap,
BitSet(buf[8], INTERLACE), &ZeroDataBlock);
} else {
+ if (!haveGlobalColormap) {
+ gdImageDestroy(im);
+ return 0;
+ }
ReadImage(im, fd, width, height,
ColorMap,
BitSet(buf[8], INTERLACE), &ZeroDataBlock);