Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 491b671f56abb71b19984d2b1cc8baa135555a797ab61342d5733b0afe2c9e14
Ticket: 26960060d75e13b704f7953bc160850e4890e6a0
lseq-3.14 triggers use-after-free
User & Date: chrstphrchvz on 2023-06-27 22:00:25
Changes

  1. comment changed to:
    Occurs after tests are run. <s>Does not seem to occur on 64-bit.</s> Introduced by [97cc33cd20fd]. AddressSanitizer (<tt>-DPURIFY -fsanitize=address</tt>) output:
    
    <pre>
    ==11283==ERROR: AddressSanitizer: heap-use-after-free on address 0xad4221b4 at pc 0xb60e0de8 bp 0xbfd96a48 sp 0xbfd96a38
    READ of size 4 at 0xad4221b4 thread T0
        #0 0xb60e0de7 in Tcl_AppendObjToObj tcl87/generic/tclStringObj.c:1790
        #1 0xb618eaab in Tcl_GetVariableFullName tcl87/generic/tclVar.c:4975
        #2 0xb61923a3 in TclDeleteNamespaceVars tcl87/generic/tclVar.c:5472
        #3 0xb5fde359 in TclTeardownNamespace tcl87/generic/tclNamesp.c:1199
        #4 0xb56fe6c4 in DeleteInterpProc tcl87/generic/tclBasic.c:1913
        #5 0xb607f9f6 in Tcl_Release tcl87/generic/tclPreserve.c:228
        #6 0xb5fd68f3 in FreeMainInterp tcl87/generic/tclMain.c:923
        #7 0xb5d6b689 in InvokeExitHandlers tcl87/generic/tclEvent.c:936
        #8 0xb5d6b82d in Tcl_Finalize tcl87/generic/tclEvent.c:1208
        #9 0xb5d6b752 in Tcl_Exit tcl87/generic/tclEvent.c:993
        #10 0xb5793245 in Tcl_ExitObjCmd tcl87/generic/tclCmdAH.c:1145
        #11 0xb571b89b in Dispatch tcl87/generic/tclBasic.c:4996
        #12 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036
        #13 0xb572e044 in TclEvalObjEx tcl87/generic/tclBasic.c:6610
        #14 0xb572deeb in Tcl_EvalObjEx tcl87/generic/tclBasic.c:6591
        #15 0xb5fd4df0 in Tcl_MainEx tcl87/generic/tclMain.c:609
        #16 0x52b5f3 in main tcl87/unix/tclAppInit.c:94
        #17 0xb4e25628  (/usr/lib/libc.so.6+0x1f628)
        #18 0xb4e256ec in __libc_start_main (/usr/lib/libc.so.6+0x1f6ec)
        #19 0x52b3fa in _start (tcl87/unix/tcltest+0x483fa)
    
    0xad4221b4 is located 4 bytes inside of 24-byte region &#91;0xad4221b0,0xad4221c8)
    freed by thread T0 here:
        #0 0xb78c0f61 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52
        #1 0xb56be305 in TclpFree tcl87/generic/tclAlloc.c:722
        #2 0xb6007745 in TclFreeObj tcl87/generic/tclObj.c:1483
        #3 0xb61802da in ArrayForLoopCallback tcl87/generic/tclVar.c:3347
        #4 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036
        #5 0xb57185b2 in Tcl_EvalObjv tcl87/generic/tclBasic.c:4755
        #6 0xb5729408 in TclEvalEx tcl87/generic/tclBasic.c:5912
        #7 0xb5f6c446 in Tcl_FSEvalFileEx tcl87/generic/tclIOUtil.c:1782
        #8 0xb5fd2ec7 in Tcl_MainEx tcl87/generic/tclMain.c:405
        #9 0x52b5f3 in main tcl87/unix/tclAppInit.c:94
        #10 0xb4e25628  (/usr/lib/libc.so.6+0x1f628)
    
    previously allocated by thread T0 here:
        #0 0xb78c2315 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0xb56be2df in TclpAlloc tcl87/generic/tclAlloc.c:699
        #2 0xb5778714 in Tcl_Alloc tcl87/generic/tclCkalloc.c:1037
        #3 0xb601469a in Tcl_NewWideIntObj tcl87/generic/tclObj.c:3333
        #4 0xb56c2e6c in TclArithSeriesObjIndex tcl87/generic/tclArithSeries.c:451
        #5 0xb5fbca28 in SetListFromAny tcl87/generic/tclListObj.c:3273
        #6 0xb6006573 in Tcl_ConvertToType tcl87/generic/tclObj.c:986
        #7 0xb60092f6 in SetDuplicatePureObj tcl87/generic/tclObj.c:1652
        #8 0xb600a009 in TclDuplicatePureObj tcl87/generic/tclObj.c:1701
        #9 0xb617debc in ArrayForNRCmd tcl87/generic/tclVar.c:3224
        #10 0xb571b89b in Dispatch tcl87/generic/tclBasic.c:4996
        #11 0xb571bca1 in TclNRRunCallbacks tcl87/generic/tclBasic.c:5036
        #12 0xb57185b2 in Tcl_EvalObjv tcl87/generic/tclBasic.c:4755
        #13 0xb5729408 in TclEvalEx tcl87/generic/tclBasic.c:5912
        #14 0xb5f6c446 in Tcl_FSEvalFileEx tcl87/generic/tclIOUtil.c:1782
        #15 0xb5fd2ec7 in Tcl_MainEx tcl87/generic/tclMain.c:405
        #16 0x52b5f3 in main tcl87/unix/tclAppInit.c:94
        #17 0xb4e25628  (/usr/lib/libc.so.6+0x1f628)
    </pre>
    
  2. icomment:
    I have now observed this error on 64-bit; not sure why I did not observe it earlier. So the error is not specific to 32-bit.
    
    This is fixed by backporting [e45cee0c53]; the test <tt>lseq-convertToList</tt> would trigger a similar error immediately rather than when exiting. So this is a duplicate of [5ee010988248] but for 8.7.
    
  3. login: "chrstphrchvz"
  4. mimetype: "text/x-fossil-wiki"
  5. title changed to: "lseq-3.14 triggers use-after-free"