summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-10-01 12:04:15 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-10-01 12:04:15 (GMT)
commit651d2c1f9e673453691dc4b7d7dc2ab6dc055aa8 (patch)
treec8d875cd113ca107e3ecc4baf3480d6480507f31
parentb9e53f337fae80f87fe2f20bd342788bdf4c16c3 (diff)
downloadtk-651d2c1f9e673453691dc4b7d7dc2ab6dc055aa8.zip
tk-651d2c1f9e673453691dc4b7d7dc2ab6dc055aa8.tar.gz
tk-651d2c1f9e673453691dc4b7d7dc2ab6dc055aa8.tar.bz2
* generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
[Bug 3078902]: Ensure that zero-dimensioned data blocks cause no changes at all instead of causing a hang.
-rw-r--r--ChangeLog16
-rw-r--r--generic/tkImgPhoto.c22
2 files changed, 30 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index b6b96d6..615f9fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,19 @@
+2010-10-01 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
+ [Bug 3078902]: Ensure that zero-dimensioned data blocks cause no
+ changes at all instead of causing a hang.
+
2010-09-29 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/tcl.m4: sync with tcl version
- * unix/configure: re-generate with autoconf-2.59
+ * unix/tcl.m4: Sync with Tcl version
+ * unix/configure: Re-generate with autoconf-2.59
* win/configure:
- * generic/tkMain.c make compilable with -DUNICODE as well
+ * generic/tkMain.c Make compilable with -DUNICODE as well
2010-09-28 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinSend.c: [Bug 3076671] CVS HEAD Tk build fails on win32
+ * win/tkWinSend.c: [Bug 3076671]: CVS HEAD Tk build fails on win32
with msys/mingw. Make it compile on older mingw as well.
* generic/tk.decls: Add explicit scspec "EXTERN", as in Tcl
* generic/tkInt.decls:
@@ -25,7 +31,7 @@
2010-09-20 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkGenStubs.tcl: clean-up, port all genStubs.tcl changes
+ * generic/ttk/ttkGenStubs.tcl: Clean-up, port all genStubs.tcl changes
* generic/ttk/ttk.decls: from Tcl to ttkGenStubs.tcl as well (no
* generic/tk.decls: change in any output files). This brings
* generic/tkInt.decls: all *.decls in the same form as tcl.decls
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index b9e99e1..589b9b8 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.97 2010/04/09 13:15:31 dkf Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.98 2010/10/01 12:04:15 dkf Exp $
*/
#include "tkImgPhoto.h"
@@ -2608,14 +2608,21 @@ Tk_PhotoPutBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- register PhotoMaster *masterPtr;
+ register PhotoMaster *masterPtr = (PhotoMaster *) handle;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
int wLeft, hLeft, wCopy, hCopy, pitch;
unsigned char *srcPtr, *srcLinePtr, *destPtr, *destLinePtr;
int sourceIsSimplePhoto = compRule & SOURCE_IS_SIMPLE_ALPHA_PHOTO;
XRectangle rect;
- masterPtr = (PhotoMaster *) handle;
+ /*
+ * Zero-sized blocks never cause any changes. [Bug 3078902]
+ */
+
+ if (blockPtr->height == 0 || blockPtr->width == 0) {
+ return TCL_OK;
+ }
+
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
@@ -2995,6 +3002,14 @@ Tk_PhotoPutZoomedBlock(
int pitch, xRepeat, yRepeat, blockXSkip, blockYSkip, sourceIsSimplePhoto;
XRectangle rect;
+ /*
+ * Zero-sized blocks never cause any changes. [Bug 3078902]
+ */
+
+ if (blockPtr->height == 0 || blockPtr->width == 0) {
+ return TCL_OK;
+ }
+
if (zoomX==1 && zoomY==1 && subsampleX==1 && subsampleY==1) {
return Tk_PhotoPutBlock(interp, handle, blockPtr, x, y, width, height,
compRule);
@@ -3021,6 +3036,7 @@ Tk_PhotoPutZoomedBlock(
yEnd = y + height;
if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
int sameSrc = (blockPtr->pixelPtr == masterPtr->pix32);
+
if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
if (interp != NULL) {