diff options
| author | dgp@users.sourceforge.net <dgp> | 2012-05-21 16:56:27 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2012-05-21 16:56:27 (GMT) |
| commit | 33775cff94e89b96352c1b28dea0883fcf54c1f3 (patch) | |
| tree | f30c1902d727ee732c8814a1aa59eeae6b54a80b | |
| parent | dd38e44a79c358e6644c6cb1908dfeb76479bf94 (diff) | |
| parent | 9b6312c2861e25e7e519982fbb1d8d5e26753dc0 (diff) | |
| download | tcl-33775cff94e89b96352c1b28dea0883fcf54c1f3.zip tcl-33775cff94e89b96352c1b28dea0883fcf54c1f3.tar.gz tcl-33775cff94e89b96352c1b28dea0883fcf54c1f3.tar.bz2 | |
When using Tcl_SetObjLength() calls to grow and shrink the objPtr->bytes buffer,
care must be taken that the value cannot possibly become pure Unicode. Calling
Tcl_AppendToObj() has the possibility of making such a conversion. Bug found
while valgrinding the trunk.
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | generic/tclFileName.c | 4 | ||||
| -rw-r--r-- | generic/tclPathObj.c | 2 |
3 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,11 @@ +2012-05-21 Don Porter <dgp@users.sourceforge.net> + + * generic/tclFileName.c: When using Tcl_SetObjLength() calls to grow + * generic/tclPathObj.c: and shrink the objPtr->bytes buffer, care must be + taken that the value cannot possibly become pure Unicode. Calling + Tcl_AppendToObj() has the possibility of making such a conversion. Bug + found while valgrinding the trunk. + 2012-05-21 Jan Nijtmans <nijtmans@users.sf.net> * win/tclWinDde.c: TIP #106: Add Encoding Abilities to the [dde] diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 5048308..b130169 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -863,7 +863,7 @@ TclpNativeJoinPath( if (length > 0 && (start[length-1] != '/')) { Tcl_AppendToObj(prefix, "/", 1); - length++; + Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; @@ -899,7 +899,7 @@ TclpNativeJoinPath( if ((length > 0) && (start[length-1] != '/') && (start[length-1] != ':')) { Tcl_AppendToObj(prefix, "/", 1); - length++; + Tcl_GetStringFromObj(prefix, &length); } needsSep = 0; diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 4f86755..2402128 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1087,7 +1087,7 @@ TclJoinPath( if (length > 0 && ptr[length -1] != '/') { Tcl_AppendToObj(res, &separator, 1); - length++; + Tcl_GetStringFromObj(res, &length); } Tcl_SetObjLength(res, length + (int) strlen(strElt)); |
