Tcl Source Code

View Ticket
Login
Ticket UUID: 1160906
Title: core dump occurs when 'getcwd()' returns null.
Type: Bug Created on: 2005-03-10 20:50:37
Submitter: tmh Assigned to: coldstore
Subsystem: 37. File System Severity:
Priority: 9 Immediate Last modified: 2006-10-31 10:20:04
Status: Closed Closed by: sf-robot
Resolution: Fixed Closed on: 2006-10-31 03:20:04
Version: obsolete: 8.5a3
Description:
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.
User Comments:
tmh added on 2005-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.

dgp added on 2006-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?

tmh added on 2006-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

dgp added on 2006-10-16 21:35:21:
Logged In: YES 
user_id=80530


Colin, does this sound
like something your recent
fixes would have corrected?

sf-robot added on 2006-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).