summaryrefslogtreecommitdiffstats
path: root/generic/tkImgGIF.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkImgGIF.c')
-rw-r--r--generic/tkImgGIF.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index aacde56..da62d1f 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -1034,7 +1034,7 @@ ReadImage(
int transparent)
{
unsigned char initialCodeSize;
- int xpos = 0, ypos = 0, pass = 0, i;
+ int xpos = 0, ypos = 0, pass = 0, i, count;
register unsigned char *pixelPtr;
static const int interlaceStep[] = { 8, 8, 4, 2 };
static const int interlaceStart[] = { 0, 4, 2, 1 };
@@ -1252,6 +1252,25 @@ ReadImage(
}
pixelPtr = imagePtr + (ypos) * len * ((transparent>=0)?4:3);
}
+
+ /*
+ * Now read until the final zero byte.
+ * It was observed that there might be 1 length blocks
+ * (test imgPhoto-14.1) which are not read.
+ *
+ * The field "stack" is abused for temporary buffer. it has 4096 bytes
+ * and we need 256.
+ *
+ * Loop until we hit a 0 length block which is the end sign.
+ */
+ while ( 0 < (count = GetDataBlock(gifConfPtr, chan, stack)))
+ {
+ if (-1 == count ) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "error reading GIF image: %s", Tcl_PosixError(interp)));
+ return TCL_ERROR;
+ }
+ }
return TCL_OK;
}