summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-08-18 14:43:58 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-08-18 14:43:58 (GMT)
commit2fcbc1a3742e8947645f3165956792424d64c635 (patch)
tree642b85e0a955995f7d32ec5bcc8f7246392ce7d4
parent9b60842d16319877dbd4d5690699e7f17908392b (diff)
downloadtcl-2fcbc1a3742e8947645f3165956792424d64c635.zip
tcl-2fcbc1a3742e8947645f3165956792424d64c635.tar.gz
tcl-2fcbc1a3742e8947645f3165956792424d64c635.tar.bz2
* generic/tclPathObj.c: Added NULL check to prevent crashes during
* tests/fileName.test: [glob]. [Bug 2837800]
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclPathObj.c10
-rw-r--r--tests/fileName.test34
3 files changed, 46 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ed72cc4..d45e52c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-18 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclPathObj.c: Added NULL check to prevent crashes during
+ * tests/fileName.test: [glob]. [Bug 2837800]
+
2009-08-06 Andreas Kupries <andreask@activestate.com>
* doc/refchan.n [Bug 2827000]: Extended the implementation of
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index bb7b0f4..282b1fc 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.66.2.7 2009/03/27 19:16:49 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.66.2.8 2009/08/18 14:43:58 dgp Exp $
*/
#include "tclInt.h"
@@ -1165,6 +1165,7 @@ Tcl_FSConvertToPathType(
return TCL_OK;
}
+
if (pathPtr->bytes == NULL) {
UpdateStringOfFsPath(pathPtr);
}
@@ -1680,8 +1681,13 @@ Tcl_FSGetTranslatedPath(
* translated result we need, and can store it for future use.
*/
- Tcl_Obj *translatedCwdPtr = Tcl_FSGetTranslatedPath(interp,
+ Tcl_Obj *translatedCwdPtr;
+
+ translatedCwdPtr = Tcl_FSGetTranslatedPath(interp,
srcFsPathPtr->cwdPtr);
+ if (translatedCwdPtr == NULL) {
+ return NULL;
+ }
retObj = Tcl_FSJoinToPath(translatedCwdPtr, 1,
&(srcFsPathPtr->normPathPtr));
diff --git a/tests/fileName.test b/tests/fileName.test
index 97bbc31..cb7f1a3 100644
--- a/tests/fileName.test
+++ b/tests/fileName.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: fileName.test,v 1.51.8.4 2009/03/27 19:16:49 dgp Exp $
+# RCS: @(#) $Id: fileName.test,v 1.51.8.5 2009/08/18 14:43:59 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -1590,6 +1590,38 @@ test fileName-20.4 {Bug 1750300} -setup {
removeDirectory foo
} -result 0
+test fileName-20.5 {Bug 2837800} -setup {
+ set dd [makeDirectory isolate]
+ set d [makeDirectory ./~foo $dd]
+ makeFile {} test $d
+ set savewd [pwd]
+ cd $dd
+} -body {
+ glob */test
+} -cleanup {
+ cd $savewd
+ removeFile test $d
+ removeDirectory ./~foo $dd
+ removeDirectory isolate
+} -result ~foo/test
+
+test fileName-20.6 {Bug 2837800} -setup {
+ # Recall that we have $env(HOME) set so that references
+ # to ~ point to [temporaryDirectory]
+ makeFile {} test ~
+ set dd [makeDirectory isolate]
+ set d [makeDirectory ./~ $dd]
+ set savewd [pwd]
+ cd $dd
+} -body {
+ glob -nocomplain */test
+} -cleanup {
+ cd $savewd
+ removeDirectory ./~ $dd
+ removeDirectory isolate
+ removeFile test ~
+} -result {}
+
# cleanup
catch {file delete -force C:/globTest}
cd [temporaryDirectory]