diff options
author | dkf <dkf@noemail.net> | 2006-03-27 10:55:49 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2006-03-27 10:55:49 (GMT) |
commit | 5d451ca8211df159b84fe3106bb414137bb8c83a (patch) | |
tree | 4d3ca2a0f7a67ad4a4dfd0ce531833fa5a90fe57 /generic/tkImgGIF.c | |
parent | 014928d0627c548b1241ee82b3b1644b00ebc487 (diff) | |
download | tk-5d451ca8211df159b84fe3106bb414137bb8c83a.zip tk-5d451ca8211df159b84fe3106bb414137bb8c83a.tar.gz tk-5d451ca8211df159b84fe3106bb414137bb8c83a.tar.bz2 |
Fix (and add test for) [Bug 1458234]
FossilOrigin-Name: 057f364ddff1f7ff992ef835c8738ceb3ab533e0
Diffstat (limited to 'generic/tkImgGIF.c')
-rw-r--r-- | generic/tkImgGIF.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 1e2bd64..70f77b0 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -32,7 +32,7 @@ * This file also contains code from miGIF. See lower down in file for the * applicable copyright notice for that portion. * - * RCS: @(#) $Id: tkImgGIF.c,v 1.31 2005/12/01 03:21:37 hobbs Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.32 2006/03/27 10:55:49 dkf Exp $ */ /* @@ -252,7 +252,7 @@ FileReadGIF( int srcX, int srcY) /* Coordinates of top-left pixel to be used in * image being read. */ { - int fileWidth, fileHeight; + int fileWidth, fileHeight, imageWidth, imageHeight; int nBytes, index = 0, argc = 0, i; Tcl_Obj **objv; Tk_PhotoImageBlock block; @@ -399,8 +399,8 @@ FileReadGIF( goto error; } - fileWidth = LM_to_uint(buf[4], buf[5]); - fileHeight = LM_to_uint(buf[6], buf[7]); + imageWidth = LM_to_uint(buf[4], buf[5]); + imageHeight = LM_to_uint(buf[6], buf[7]); bitPixel = 1<<((buf[8]&0x07)+1); @@ -443,7 +443,7 @@ FileReadGIF( */ if (ReadImage(gifConfPtr, interp, (char *)trashBuffer, chan, - fileWidth, fileHeight, colorMap, 0, 0, 0, 0, 0, + imageWidth, imageHeight, colorMap, 0, 0, 0, 0, 0, -1) != TCL_OK) { goto error; } @@ -464,8 +464,8 @@ FileReadGIF( srcX = 0; } - if (width > fileWidth) { - width = fileWidth; + if (width > imageWidth) { + width = imageWidth; } index = LM_to_uint(buf[2], buf[3]); @@ -474,8 +474,8 @@ FileReadGIF( destY -= srcY; height += srcY; srcY = 0; } - if (height > fileHeight) { - height = fileHeight; + if (height > imageHeight) { + height = imageHeight; } if ((width <= 0) || (height <= 0)) { @@ -487,13 +487,13 @@ FileReadGIF( block.height = height; block.pixelSize = (transparent>=0) ? 4 : 3; block.offset[3] = (transparent>=0) ? 3 : 0; - block.pitch = block.pixelSize * fileWidth; - nBytes = block.pitch * fileHeight; + block.pitch = block.pixelSize * imageWidth; + nBytes = block.pitch * imageHeight; block.pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes); if (ReadImage(gifConfPtr, interp, (char *) block.pixelPtr, chan, - fileWidth, fileHeight, colorMap, fileWidth, fileHeight, srcX, - srcY, BitSet(buf[8], INTERLACE), transparent) != TCL_OK) { + imageWidth,imageHeight, colorMap, fileWidth,fileHeight, + srcX,srcY, BitSet(buf[8],INTERLACE), transparent) != TCL_OK) { goto error; } break; |