summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2024-06-08 09:07:18 (GMT)
committerfvogel <fvogelnew1@free.fr>2024-06-08 09:07:18 (GMT)
commit9b6c43c2c577b2b086822e8c98bb2a2b4c5b852a (patch)
tree1ccce2eccb2eec1243862ab181a7aa77c0a7e6d6
parent249fc690380f4cb9524794298a86a314ee4d53a5 (diff)
downloadtk-9b6c43c2c577b2b086822e8c98bb2a2b4c5b852a.zip
tk-9b6c43c2c577b2b086822e8c98bb2a2b4c5b852a.tar.gz
tk-9b6c43c2c577b2b086822e8c98bb2a2b4c5b852a.tar.bz2
Better fix for [a0241c0e25]. The checks for coordinates outside of the source image were incorrect.
-rw-r--r--generic/tkImgPhoto.c6
-rw-r--r--tests/imgPhoto.test2
2 files changed, 3 insertions, 5 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 61d1c9b..e619910 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -577,7 +577,7 @@ ImgPhotoCmd(
return TCL_ERROR;
}
Tk_PhotoGetImage(srcHandle, &block);
- if ((options.fromX2 > block.width) || (options.fromY2 > block.height)
+ if ((options.fromX > block.width) || (options.fromY > block.height)
|| (options.fromX2 > block.width)
|| (options.fromY2 > block.height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -3171,11 +3171,9 @@ Tk_PhotoPutZoomedBlock(
/*
* Zero-sized blocks never cause any changes. [Bug 3078902]
- * Negative-size blocks happen when trying to copy from an area outside
- * the source image. [Bug a0241c0e25]
*/
- if (blockPtr->height <= 0 || blockPtr->width <= 0) {
+ if (blockPtr->height == 0 || blockPtr->width == 0) {
return TCL_OK;
}
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index c006775..865e96c 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1064,7 +1064,7 @@ test imgPhoto-12.5 {Tk_ImgPhotoPutZoomedBlock, copy from area outside the image,
photo2 copy photo1 -to 0 5 3 8 -from 21 0
} -cleanup {
imageCleanup
-}
+} -returnCodes error -result {coordinates for -from option extend outside source image}
test imgPhoto-13.1 {check separation of images in different interpreters} -setup {
imageCleanup