Skip to content
Tcl Source Code View Ticket
Login

View Ticket

new crash in [http::cookiejar create tracer] (-setup of test 2.15)

Closed / Fixedfa7995bdf21e0d9d73418a498038dd57c2b2464fCreated 2 years agoUpdated 1 year ago
Descriptionplain2025-05-23 18:52:37
testing the tip of the trunk...

$ make test-tcl TESTFLAGS="-file httpcookie.test -verbose bpste"
...
---- http-cookiejar-2.14 start
++++ http-cookiejar-2.14 PASSED
Test file error: child killed: segmentation violation


If I can find time to dig deeper, I'll add more details here.
Referenced by4
dgpplain2025-05-23 18:55:39
It is the TIP 720 checkin that creates the crash.
dgpplain2025-05-23 19:37:45
Program received signal SIGSEGV, Segmentation fault.
0x000055555564d9fb in TEBCresume (data=0x555555e89aa8, interp=0x555555839c80, result=0) at /home/dgp/fossil/tcl/generic/tclExecute.c:3229
3229		while (TclIsVarLink(varPtr)) {
(gdb) bt
#0  0x000055555564d9fb in TEBCresume (data=0x555555e89aa8, 
    interp=0x555555839c80, result=0)
    at /home/dgp/fossil/tcl/generic/tclExecute.c:3229
#1  0x00005555555acb23 in TclNRRunCallbacks (interp=0x555555839c80, result=0, 
    rootPtr=0x0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4655
#2  0x00005555555ac214 in Tcl_EvalObjv (interp=0x555555839c80, objc=3, 
    objv=0x55555583e010, flags=2097168)
    at /home/dgp/fossil/tcl/generic/tclBasic.c:4394
#3  0x00005555555aef5c in TclEvalEx (interp=0x555555839c80, 
    script=0x5555558def70 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"..., numBytes=988, flags=0, line=25, clNextOuter=0x0, 
    outerScript=0x5555558def70 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"...) at /home/dgp/fossil/tcl/generic/tclBasic.c:5494
#4  0x000055555569abfb in Tcl_FSEvalFileEx (interp=0x555555839c80, 
    pathPtr=0x555555881ce0, encodingName=0x55555578b159 "utf-8")
    at /home/dgp/fossil/tcl/generic/tclIOUtil.c:1792
#5  0x00005555556a9ce3 in Tcl_MainEx (argc=-1, argv=0x7fffffffdde8, 
    appInitProc=0x55555557fa5c <Tcl_AppInit>, interp=0x555555839c80)
    at /home/dgp/fossil/tcl/generic/tclMain.c:404
#6  0x000055555557fa5c in main (argc=8, argv=0x7fffffffdde8)
    at /home/dgp/fossil/tcl/unix/tclAppInit.c:94
dgpplain2025-05-30 15:35:32
Crash happens during execution of INST_STORE_SCALAR instruction.

Value of varIdx (which is taken as an operand from the bytecode)
is 4294967295, which looks like a -1 dropped into an unsigned int.

LOCAL(varIdx) is delivering a pointer at a big offset from where
a local variable array is rooted, and that points to memory not
belonging to us -->>> CRASH.
dgpplain2025-05-30 16:13:23
The crash is in the -setup script of the 2.15 test
in the command [http:cookiejar create tracer].
dgpplain2025-05-30 16:17:40
Source of the trouble is in IssueDictWithBodied, where

    keysTmp = AnonymousLocal(envPtr);

produces TCL_INDEX_NONE, as AnonymousLocal() appears intended to do.

But execution of INST_STORE_SCALAR is not happy with that.
dgpplain2025-05-30 18:56:49
Branch bug-fa7995bdf2 contains a fix for the crashing test.
dgpplain2025-06-02 13:38:29
I would like to stop test suite crash on the trunk.
Can you take a moment to give this a code review?
jan.nijtmanswiki2025-06-03 17:29:41

If @dkf doesn't react, I suggest to just merge the fix

dgp Closed ticket [fa7995bdf2]. [History diff]2025-06-12 15:13:30
dkfmarkdown2025-06-13 07:34:08

Fix looks fine. I can't run the http-related tests locally because this machine has some weird networking configs (either from my work VPN or from my ISP). Things break when I try, and I'm certain they're not Tcl's fault; the environment is wonky.

I guess we need another test case in dict.test.

dkfmarkdown2025-06-13 07:47:32

Test dict-22.25 added, and confirmed that the fix changes the test from crashing to working.

dkfmarkdown2025-06-13 08:55:51

I've reviewed the commands that care about this, and found a few others that had similar problems (e.g., dict merge). Fixed.

dgpplain2025-06-13 14:08:44
Thanks for the review and improvements.

A semi-related matter at ticket [81ebe684b4]
Log in (anonymous is fine) to add a comment.