View Ticket
Not logged in
Ticket UUID: 51d5f229971550e1751d62df4a25c3052b63f4a8
Title: Panic in InitArgsAndLocals
Type: Bug Version: trunk
Submitter: dgp Created on: 2022-09-15 15:41:13
Subsystem: 22. [proc] and [uplevel] Assigned To: dgp
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2022-09-15 16:01:51
Resolution: Fixed Closed By: dgp
    Closed on: 2022-09-15 16:01:51
Description:
% proc foo {{x {}} {y {}} args} {}
% foo
max length of a Tcl list exceeded

Program received signal SIGILL, Illegal instruction.
Tcl_Panic (format=0x60e148 "max length of a Tcl list exceeded")
    at /home/dgp/fossil/tcl/generic/tclPanic.c:108
108             __builtin_trap();
Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 zlib-1.2.7-20.el7_9.x86_64
(gdb) bt
#0  Tcl_Panic (format=0x60e148 "max length of a Tcl list exceeded")
    at /home/dgp/fossil/tcl/generic/tclPanic.c:108
#1  0x0000000000546ad9 in ListStoreNew (objc=18446744073709551614, 
    objv=0x8b6938, flags=1) at /home/dgp/fossil/tcl/generic/tclListObj.c:762
#2  0x0000000000546d5c in ListRepInit (objc=18446744073709551614, 
    objv=0x8b6938, flags=1, repPtr=0x7fffffffd080)
    at /home/dgp/fossil/tcl/generic/tclListObj.c:900
#3  0x0000000000547251 in Tcl_NewListObj (objc=18446744073709551614, 
    objv=0x8b6938) at /home/dgp/fossil/tcl/generic/tclListObj.c:1112
#4  0x000000000056f479 in InitArgsAndLocals (interp=0x8b2870, skip=1)
    at /home/dgp/fossil/tcl/generic/tclProc.c:1434
#5  0x000000000056fa4a in TclNRInterpProcCore (interp=0x8b2870, 
    procNameObj=0x982aa0, skip1=1, errorProc=0x57011b <MakeProcError>)
    at /home/dgp/fossil/tcl/generic/tclProc.c:1670
#6  0x000000000056fa00 in TclNRInterpProc (clientData=0x930b50, 
    interp=0x8b2870, objc=1, objv=0x8b6920)
    at /home/dgp/fossil/tcl/generic/tclProc.c:1632
#7  0x00000000004153d0 in Dispatch (data=0x982898, interp=0x8b2870, 
    dummy4586=0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4624
#8  0x0000000000415437 in TclNRRunCallbacks (interp=0x8b2870, result=0, 
    rootPtr=0x0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4640
#9  0x000000000041813b in TclEvalObjEx (interp=0x8b2870, objPtr=0x901160, 
    flags=131072, invoker=0x0, word=0)
    at /home/dgp/fossil/tcl/generic/tclBasic.c:6087
#10 0x00000000004180cf in Tcl_EvalObjEx (interp=0x8b2870, objPtr=0x901160, 
    flags=131072) at /home/dgp/fossil/tcl/generic/tclBasic.c:6068
#11 0x00000000005f9b8f in Tcl_RecordAndEvalObj (interp=0x8b2870, 
    cmdPtr=0x901160, flags=131072)
    at /home/dgp/fossil/tcl/generic/tclHistory.c:182
#12 0x000000000054fc59 in Tcl_MainEx (argc=18446744073709551615, 
    argv=0x7fffffffd648, appInitProc=0x40ef3c <Tcl_AppInit>, interp=0x8b2870)
    at /home/dgp/fossil/tcl/generic/tclMain.c:524
#13 0x000000000040ef3c in main (argc=1, argv=0x7fffffffd648)
    at /home/dgp/fossil/tcl/unix/tclAppInit.c:94



Tcl_NewListObj now very much dislikes getting passed objc == -2 .
User Comments: dgp added on 2022-09-15 16:00:51:
Guards added to the caller at fault here.  Test to prevent regression.

This episode suggests that the new intolerance of Tcl_NewListObj() for
objc argument <= -2 needs to be very high on the list of migration gotchas
that we warn people about.