diff options
-rw-r--r-- | generic/tkImgPNG.c | 12 | ||||
-rw-r--r-- | generic/tkTextWind.c | 16 | ||||
-rw-r--r-- | tests/text.test | 2 | ||||
-rw-r--r-- | tests/textWind.test | 17 | ||||
-rwxr-xr-x | win/configure | 4 | ||||
-rw-r--r-- | win/tcl.m4 | 4 |
6 files changed, 40 insertions, 15 deletions
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 9d0fb30..2ee515b 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -1847,6 +1847,13 @@ DecodeLine( if (UnfilterLine(interp, pngPtr) == TCL_ERROR) { return TCL_ERROR; } + if (pngPtr->currentLine >= pngPtr->block.height) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "PNG image data overflow")); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "DATA_OVERFLOW", NULL); + return TCL_ERROR; + } + if (pngPtr->interlace) { switch (pngPtr->phase) { @@ -1881,8 +1888,6 @@ DecodeLine( * Calculate offset into pixelPtr for the first pixel of the line. */ - assert(pngPtr->currentLine < pngPtr->block.height); - offset = pngPtr->currentLine * pngPtr->block.pitch; /* @@ -2092,8 +2097,7 @@ ReadIDAT( * Process IDAT contents until there is no more in this chunk. */ - while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream) - && pngPtr->currentLine < pngPtr->block.height) { + while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) { int len1, len2; /* diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index bd61d75..c9fc20f 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1134,6 +1134,16 @@ TkTextEmbWinDisplayProc( &lineX, &windowY, &width, &height); windowX = lineX - chunkPtr->x + x; + /* + * Mark the window as displayed so that it won't get unmapped. + * This needs to be done before the next instruction block because + * Tk_MaintainGeometry/Tk_MapWindow will run event handlers, in + * particular for the <Map> event, and if the bound script deletes + * the embedded window its clients will get freed. + */ + + client->displayed = 1; + if (textPtr->tkwin == Tk_Parent(tkwin)) { if ((windowX != Tk_X(tkwin)) || (windowY != Tk_Y(tkwin)) || (Tk_ReqWidth(tkwin) != Tk_Width(tkwin)) @@ -1145,12 +1155,6 @@ TkTextEmbWinDisplayProc( Tk_MaintainGeometry(tkwin, textPtr->tkwin, windowX, windowY, width, height); } - - /* - * Mark the window as displayed so that it won't get unmapped. - */ - - client->displayed = 1; } /* diff --git a/tests/text.test b/tests/text.test index 0a481de..5b85b4f 100644 --- a/tests/text.test +++ b/tests/text.test @@ -2663,7 +2663,7 @@ test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup { .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n" } .mytop.t tag configure hidden -elide true - .mytop.t tag add hidden 2.15 3.10 + .mytop.t tag add hidden 2.20 3.10 .mytop.t configure -wrap char lappend res [.mytop.t count -displaylines 2.0 3.0] lappend res [.mytop.t count -displaylines 2.0 3.40] diff --git a/tests/textWind.test b/tests/textWind.test index c3483e6..27b7309 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -1458,6 +1458,23 @@ test textWind-17.10 {peer widget window configuration} -setup { destroy .tt .t } -result {{-window {} {} {} {}} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}} +test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -setup { + catch {destroy .t .f .f2} +} -body { + pack [text .t] + for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} + .t window create end -window [frame .f -background red -width 80 -height 80] + .t window create end -window [frame .f2 -background blue -width 80 -height 80] + bind .f <Map> {.t delete .f} + update + # this shall not crash (bug 1501749) + after 100 {.t yview end} + tkwait visibility .f2 + update +} -cleanup { + destroy .t .f .f2 +} -result {} + option clear # cleanup diff --git a/win/configure b/win/configure index 1959f8f..5840966 100755 --- a/win/configure +++ b/win/configure @@ -3907,7 +3907,7 @@ echo "${ECHO_T}using shared flags" >&6 LIBRARIES="\${SHARED_LIBRARIES}" EXESUFFIX="\${DBGX}.exe" case "x`echo \${VisualStudioVersion}`" in - x14*) + x1[4-9]*) lflags="${lflags} -nodefaultlib:libucrt.lib" ;; *) @@ -3955,7 +3955,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in - x14*) + x1[4-9]*) LIBS="$LIBS ucrt.lib" ;; *) @@ -792,7 +792,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LIBRARIES="\${SHARED_LIBRARIES}" EXESUFFIX="\${DBGX}.exe" case "x`echo \${VisualStudioVersion}`" in - x14*) + x1[4-9]*) lflags="${lflags} -nodefaultlib:libucrt.lib" ;; *) @@ -837,7 +837,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in - x14*) + x1[4-9]*) LIBS="$LIBS ucrt.lib" ;; *) |