Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-10-31
10:20 • Closed ticket [1160906fff]: core dump occurs when 'getcwd()' returns nul... artifact: 41496a1beb user: sf-robot
2006-10-16
21:35 • Pending ticket [1160906fff]. artifact: 810a54c977 user: dgp
2006-03-10
20:54 • Ticket [1160906fff]: 4 changes artifact: 3f3c53ab7e user: tmh
13:02 • Ticket [1160906fff]: 5 changes artifact: 1f4af7073d user: dgp
2005-05-30
08:56 • Ticket [1160906fff]: 2 changes artifact: 1e27f2bbae user: hobbs
2005-03-11
23:23 • Ticket [1160906fff]: 1 change artifact: 92da367f53 user: vincentdarley
03:52 • Ticket [1160906fff]: 4 changes artifact: ddb1f0e670 user: tmh
2005-03-10
20:50 • New ticket [1160906fff]. artifact: 4525ba4ec8 user: tmh

core dump occurs when 'getcwd()' returns null.

Closed / Fixed1160906fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 20 years ago
Descriptionplain2005-03-10 20:50:37
The tclUnixFile.c file has a function
TclNativeCreateNativeRep().

line 977 -> 979 has a problem.

        /* Make sure the normalized path is set */
        validPathPtr = Tcl_FSGetNormalizedPath(NULL,
pathPtr);
        Tcl_IncrRefCount(validPathPtr);

It is possible to construct a situation where
validPathPtr is returned as NULL, and
Tcl_IncrRefCount(NULL); causes a core dump.


The situation leading to this is complicated.

First a directory is created.
/var/cores/programname
This directory is mode 0700 and owned by root.

A 'C' program starts as root, 
changes directory to /var/cores/programname.
drops 'root' permission to a user permision.
Opens a tcl interpreter.
Tcl_EvalFiles some tcl file that includes a [clock
format] command

Core dump occurs.

This code has worked in all versions of Tcl 8.3, 8.4
and 8.5 until recently.

I have a relatively small test file available, but I do
not wish to post it to the web.  I will email it to
those interested.
tmhplain2005-03-11 03:52:16
Logged In: YES 
user_id=92123

I forgot to mention.

This is solaris 2.9 platform.
The same core dump occurs with 'gcc' compiles and 'Sun' C
compiler.
vincentdarley Ticket [1160906fff]: 1 change [History diff]2005-03-11 23:23:05
hobbs Ticket [1160906fff]: 2 changes [History diff]2005-05-30 08:56:40
dgpplain2006-03-10 13:02:38
Logged In: YES 
user_id=80530


crash sounds bad.  raising prio.

Is this report still valid against
the Tcl HEAD?
tmhplain2006-03-10 20:54:12
Logged In: YES 
user_id=92123

I don't know if it's still valid or not. I will try and find
my test code from a year ago, if I cannot find the code,
I'll withdraw the report.

-Todd
dgpplain2006-10-16 21:35:21
Logged In: YES 
user_id=80530


Colin, does this sound
like something your recent
fixes would have corrected?
sf-robotplain2006-10-31 10:20:04
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.