Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-09-15
16:01 • Closed ticket [51d5f22997]: Panic in InitArgsAndLocals plus 6 other changes artifact: ed29066c86 user: dgp
16:00 • Ticket [51d5f22997]: 3 changes artifact: 7f2a791971 user: dgp
15:59
[51d5f22997] Protect against passing negative size to Tcl_NewListObj. check-in: a88a630a36 user: dgp tags: trunk, main
15:41 • New ticket [51d5f22997] Panic in InitArgsAndLocals. artifact: 6bfe9caab1 user: dgp

Panic in InitArgsAndLocals

Closed / Fixed51d5f229971550e1751d62df4a25c3052b63f4a8Created 4 years agoUpdated 4 years ago
Descriptionplain2022-09-15 15:41:13
% 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 .
Referenced by1
dgpplain2022-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.
dgp Closed ticket [51d5f22997]. [History diff]2022-09-15 16:01:51
Log in (anonymous is fine) to add a comment.