Tk Source Code

View Ticket
Login
Ticket UUID: ba956c8ff7939ad5a4bfabfbfc4cde3ece8e1ae3
Title: Aqua: TIP 655 use-after-free
Type: Patch Version: trunk
Submitter: chrstphrchvz Created on: 2023-05-03 11:11:12
Subsystem: 66. Aqua Window Operations Assigned To: fvogel
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2023-05-05 17:17:10
Resolution: Fixed Closed By: fvogel
    Closed on: 2023-05-05 17:17:10
Description:

Can be triggered by launching the mac_tabs widget demo. See attached patch.

==55228==ERROR: AddressSanitizer: heap-use-after-free on address 0x6020001c7fb0 at pc 0x000106afb2f5 bp 0x7ff7b9f3cac0 sp 0x7ff7b9f3c288
READ of size 4 at 0x6020001c7fb0 thread T0
    #0 0x106afb2f4 in wrap_strlen+0x184 (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x192f4)
    #1 0x7ff81d293376 in +[NSString stringWithUTF8String:]+0x1c (Foundation:x86_64+0x24376)
    #2 0x108e4df48 in TkMacOSXMakeRealWindowExist tkMacOSXWm.c:6759
    #3 0x108e48e7e in TkWmMapWindow tkMacOSXWm.c:986
    #4 0x1083ff317 in Tk_MapWindow tkWindow.c:1761
    #5 0x108492314 in MapFrame tkFrame.c:1908
    #6 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #7 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #8 0x1084920e7 in MapFrame tkFrame.c:1894
    #9 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #10 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #11 0x1084920e7 in MapFrame tkFrame.c:1894
    #12 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #13 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #14 0x1084920e7 in MapFrame tkFrame.c:1894
    #15 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #16 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #17 0x1081da6a9 in Tk_UpdateObjCmd tkCmds.c:1211
    #18 0x10b4c0cc8 in Dispatch tclBasic.c:4997
    #19 0x10b49f23e in TclNRRunCallbacks tclBasic.c:5037
    #20 0x10b49d5ab in Tcl_EvalObjv tclBasic.c:4756
    #21 0x10b4abf7d in TclEvalEx tclBasic.c:5913
    #22 0x10b4a41a9 in Tcl_EvalEx tclBasic.c:5577
    #23 0x10816e2f0 in Tk_BindEvent tkBind.c:2624
    #24 0x108b05764 in TagBindEvent tkTextTag.c:1752
    #25 0x108aff2a7 in TkTextBindProc tkTextTag.c:1457
    #26 0x10824a409 in Tk_HandleEvent tkEvent.c:1285
    #27 0x108252ff0 in WindowEventProc tkEvent.c:1738
    #28 0x10c20fd48 in Tcl_ServiceEvent tclNotify.c:710
    #29 0x10c212881 in Tcl_DoOneEvent tclNotify.c:1007
    #30 0x108256b8f in Tk_MainLoop tkEvent.c:2124
    #31 0x108328a1c in Tk_MainEx tkMain.c:388
    #32 0x105fc2aef in main tkAppInit.c:96
    #33 0x106a2f52d in start+0x1cd (dyld:x86_64+0x552d)

0x6020001c7fb0 is located 0 bytes inside of 7-byte region [0x6020001c7fb0,0x6020001c7fb7)
freed by thread T0 here:
    #0 0x106b2b149 in wrap_free+0xa9 (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x49149)
    #1 0x10b41a9a4 in TclpFree tclAlloc.c:722
    #2 0x10b52b4a4 in Tcl_Free tclCkalloc.c:1182
    #3 0x108e4c235 in TkMacOSXMakeRealWindowExist tkMacOSXWm.c:6701
    #4 0x108e48e7e in TkWmMapWindow tkMacOSXWm.c:986
    #5 0x1083ff317 in Tk_MapWindow tkWindow.c:1761
    #6 0x108492314 in MapFrame tkFrame.c:1908
    #7 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #8 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #9 0x1084920e7 in MapFrame tkFrame.c:1894
    #10 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #11 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #12 0x1084920e7 in MapFrame tkFrame.c:1894
    #13 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #14 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #15 0x1084920e7 in MapFrame tkFrame.c:1894
    #16 0x10c3baea9 in TclServiceIdle tclTimer.c:751
    #17 0x10c212903 in Tcl_DoOneEvent tclNotify.c:1020
    #18 0x1081da6a9 in Tk_UpdateObjCmd tkCmds.c:1211
    #19 0x10b4c0cc8 in Dispatch tclBasic.c:4997
    #20 0x10b49f23e in TclNRRunCallbacks tclBasic.c:5037
    #21 0x10b49d5ab in Tcl_EvalObjv tclBasic.c:4756
    #22 0x10b4abf7d in TclEvalEx tclBasic.c:5913
    #23 0x10b4a41a9 in Tcl_EvalEx tclBasic.c:5577
    #24 0x10816e2f0 in Tk_BindEvent tkBind.c:2624
    #25 0x108b05764 in TagBindEvent tkTextTag.c:1752
    #26 0x108aff2a7 in TkTextBindProc tkTextTag.c:1457
    #27 0x10824a409 in Tk_HandleEvent tkEvent.c:1285
    #28 0x108252ff0 in WindowEventProc tkEvent.c:1738
    #29 0x10c20fd48 in Tcl_ServiceEvent tclNotify.c:710
    #30 0x10c212881 in Tcl_DoOneEvent tclNotify.c:1007
    #31 0x108256b8f in Tk_MainLoop tkEvent.c:2124
    #32 0x108328a1c in Tk_MainEx tkMain.c:388
    #33 0x105fc2aef in main tkAppInit.c:96
    #34 0x106a2f52d in start+0x1cd (dyld:x86_64+0x552d)

previously allocated by thread T0 here:
    #0 0x106b2b000 in wrap_malloc+0xa0 (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x49000)
    #1 0x10b41a984 in TclpAlloc tclAlloc.c:699
    #2 0x10b52b172 in Tcl_Alloc tclCkalloc.c:1037
    #3 0x108e612ad in WmAttributesCmd tkMacOSXWm.c:2088
    #4 0x108e5c7a4 in Tk_WmObjCmd tkMacOSXWm.c:1458
    #5 0x10b4c0cc8 in Dispatch tclBasic.c:4997
    #6 0x10b49f23e in TclNRRunCallbacks tclBasic.c:5037
    #7 0x10b49d5ab in Tcl_EvalObjv tclBasic.c:4756
    #8 0x10b4abf7d in TclEvalEx tclBasic.c:5913
    #9 0x10b4a41a9 in Tcl_EvalEx tclBasic.c:5577
    #10 0x10816e2f0 in Tk_BindEvent tkBind.c:2624
    #11 0x108b05764 in TagBindEvent tkTextTag.c:1752
    #12 0x108aff2a7 in TkTextBindProc tkTextTag.c:1457
    #13 0x10824a409 in Tk_HandleEvent tkEvent.c:1285
    #14 0x108252ff0 in WindowEventProc tkEvent.c:1738
    #15 0x10c20fd48 in Tcl_ServiceEvent tclNotify.c:710
    #16 0x10c212881 in Tcl_DoOneEvent tclNotify.c:1007
    #17 0x108256b8f in Tk_MainLoop tkEvent.c:2124
    #18 0x108328a1c in Tk_MainEx tkMain.c:388
    #19 0x105fc2aef in main tkAppInit.c:96
    #20 0x106a2f52d in start+0x1cd (dyld:x86_64+0x552d)

User Comments: fvogel added on 2023-05-05 17:17:10:
Merged in trunk. Thanks!

fvogel added on 2023-05-03 19:43:52:

Thanks! Committed in [c9c7d933].


Attachments: