diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2006-03-27 10:55:49 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2006-03-27 10:55:49 (GMT) |
commit | 525f1a7466a169620c320643214fa1bc50809d30 (patch) | |
tree | 4d3ca2a0f7a67ad4a4dfd0ce531833fa5a90fe57 /generic | |
parent | 5f87593323244e86ce48d4aa8c21ad14f5d91db3 (diff) | |
download | tk-525f1a7466a169620c320643214fa1bc50809d30.zip tk-525f1a7466a169620c320643214fa1bc50809d30.tar.gz tk-525f1a7466a169620c320643214fa1bc50809d30.tar.bz2 |
Fix (and add test for) [Bug 1458234]
Diffstat (limited to 'generic')
-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; |