summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2024-06-09 12:38:18 (GMT)
committerfvogel <fvogelnew1@free.fr>2024-06-09 12:38:18 (GMT)
commit5a402a02819a88efce8f6b673d447f099726c388 (patch)
tree056fee4633fd9de35ede8e545505227de060fded
parent9bca6671f1b75062855142650431b8e0536bc660 (diff)
parent13ad83e207e848df4017b03f3f51087b16c2b079 (diff)
downloadtk-5a402a02819a88efce8f6b673d447f099726c388.zip
tk-5a402a02819a88efce8f6b673d447f099726c388.tar.gz
tk-5a402a02819a88efce8f6b673d447f099726c388.tar.bz2
Fix [a0241c0e25]: photo image copy command can unexpectedly hang for 20+ seconds.
-rw-r--r--generic/tkImgPhoto.c2
-rw-r--r--tests/imgPhoto.test11
2 files changed, 12 insertions, 1 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index cbd91c4..0c38cc4 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -620,7 +620,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(
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 6ca3bc6..58c8653 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1598,6 +1598,17 @@ test imgPhoto-12.4 {Tk_ImgPhotoPutZoomedBlock, empty image} -setup {
} -cleanup {
imageCleanup
} -result {0 0}
+test imgPhoto-12.5 {Tk_ImgPhotoPutZoomedBlock, copy from area outside the image, bug [a0241c0e25]} -setup {
+ imageCleanup
+} -body {
+ image create photo photo1 -width 20 -height 20
+ image create photo photo2 -width 9 -height 10
+ # next line used to loop for a very long time; if the bug is present
+ # the CI runner will time out, leading to test suite failure
+ 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