diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2019-03-04 18:36:36 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2019-03-04 18:36:36 (GMT) |
commit | 9470b0e3ea0f2b6495852aa069a0e8b06d85d774 (patch) | |
tree | 321702493cdef0c9abb707c4298277a6b14a76c0 /generic | |
parent | ff204cc30af52bf00260514cc8998da8de614f5c (diff) | |
parent | 7ee00057db4a080edfaf39bc921f7eb58d64a459 (diff) | |
download | tk-9470b0e3ea0f2b6495852aa069a0e8b06d85d774.zip tk-9470b0e3ea0f2b6495852aa069a0e8b06d85d774.tar.gz tk-9470b0e3ea0f2b6495852aa069a0e8b06d85d774.tar.bz2 |
gif read not complete on overflow image - information missinterpreted if following subimage is querried [4da2191b]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkImgGIF.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 7c4872b..fa4b728 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; } |