Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-20
02:58 • Ticket [219416ffff] Application crashes if sarted in top level dir, e.g. K:\myAp... artifact: d033333a43 user: dgp
2001-01-05
04:33 • Closed ticket [219416ffff]. artifact: 7139b5b364 user: dgp
2000-12-21
05:40 • Ticket [219416ffff]: 3 changes artifact: 1e1790296c user: dgp
05:34 • Ticket [219416ffff]: 5 changes artifact: d028e83201 user: dgp
2000-11-19
18:43 • Ticket [219416ffff]: 5 changes artifact: 17ed1505db user: dkf
2000-10-26
05:12 • New ticket [219416ffff]. artifact: 2eb5a00a5a user: nobody

Application crashes if sarted in top level dir, e.g. K:\myAp

Closed / Fixed219416ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:12:39
OriginalBugID: 6364 Bug
Version: 8.3.2
SubmitDate: '2000-10-16'
LastModified: '2000-10-25'
Severity: CRIT
Status: UnAssn
Submitter: techsupp
OS: Windows NT
OSVersion: Windown NT, 4.0 SP 5
Machine: Dual Pentium III, >500MHz
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:

Jens-Achim Kessel


CVS:

Id: tclWinInit.c,v 1.22 2000/03/31 08:52:31 hobbs Exp


Extensions:

Tcl 8.3.2 / Tk 8.3.2 / Tix 8.0


CustomShell:

(For easy bugfixing in our own packages i've compiled all libraries as hidden debug-version, e.g. tcl8.3.dll does contain debug information. It's better for our purposals.)


ReproducibleScript:

Tcl is embedded in a LabVIEW environment. The application works fine in Development environment and crashes with a RuntimeError #3 if started from the Runtime Environment. Following up the program with C++ Debugger, it crashes in Line 293 ckfree(...) of tclWinInit.c. At this point no Tcl script was executed. It's still in the basic initialization part of Tcl, inside Tcl_FindExecutable(...).


ObservedBehavior:

Inside TclpInitLibraryPath(), Line 279/280:

    if (pathc > 1) {

        pathv[pathc - 3] = developLib;

will access element [-1] if started as 'K:\myApp.exe' => crash follows, when memory of pathv if freed.


DesiredBehavior:

Should better be:

    if (pathc > 2) {

        pathv[pathc - 3] = developLib;

I changed the line and it works fine now without a crash!


Patch:

*** tclWinInit.c.old    Mon Oct 16 17:59:41 2000

--- tclWinInit.c.new    Mon Oct 16 16:00:12 2000

***************

*** 276,282 ****

            Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);

            Tcl_DStringFree(&ds);

        }

!       if (pathc > 1) {

            pathv[pathc - 3] = developLib;

            path = Tcl_JoinPath(pathc - 2, pathv, &ds);

            objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds));

--- 276,282 ----

            Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);

            Tcl_DStringFree(&ds);

        }

!       if (pathc > 2) {

            pathv[pathc - 3] = developLib;

            path = Tcl_JoinPath(pathc - 2, pathv, &ds);

            objPtr = Tcl_NewStringObj(path, Tcl_DStringLength(&ds));


PatchFiles:

tcl8.3.2/win/tclWinInit.c
dkfplain2000-11-19 18:43:02
Seems to work for me in 8.3.0; strange...
dgpplain2000-12-21 05:34:16
Confirmed.  The buggy code may attempt to access pathv[-1].

The same bug is also present in the Unix initialization.
To demonstrate it there:

$ configure --disable-shared
$ make
$ cp ./tclsh /
$ /tclsh
Segmentation fault

Patch 102972 contains a fix.
dgp Ticket [219416ffff]: 3 changes [History diff]2000-12-21 05:40:51
dgpplain2001-01-05 04:33:06
Fixed by integration of Patch 102972.
dgp Ticket [219416ffff]: 3 changes [History diff]2001-04-20 02:58:03
Log in (anonymous is fine) to add a comment.