54 lines
1.6 KiB
Diff
54 lines
1.6 KiB
Diff
|
|
From 17fc6d054e41444b64b3f56bdca60b2765402071 Mon Sep 17 00:00:00 2001
|
|||
|
|
From: oehhar <harald.oehlmann@elmicron.de>
|
|||
|
|
Date: Sun, 3 Feb 2019 11:21:11 +0000
|
|||
|
|
Subject: [PATCH 644/693] gif read not complete on overflow image - information
|
|||
|
|
missinterpreted if following subimage is querried [4da2191b]
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
generic/tkImgGIF.c | 21 ++++++++++++++++++++-
|
|||
|
|
tests/imgPhoto.test | 33 +++++++++++++++++++++++++++++++++
|
|||
|
|
2 files changed, 53 insertions(+), 1 deletion(-)
|
|||
|
|
|
|||
|
|
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
|
|||
|
|
index 7c4872bef..fa4b728d3 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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
--
|
|||
|
|
2.19.1
|
|||
|
|
|