diff options
author | dgp <dgp@noemail.net> | 2009-03-21 02:53:17 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2009-03-21 02:53:17 (GMT) |
commit | c0c51affb865f307ac0588533c21a70380cc6b6a (patch) | |
tree | 5ec5f24bbefd332a7404fbb73c76d154d7653409 /generic/tclStringObj.c | |
parent | 1a859e41363f365cdd3deddebbcfb3a323d19627 (diff) | |
download | tcl-c0c51affb865f307ac0588533c21a70380cc6b6a.zip tcl-c0c51affb865f307ac0588533c21a70380cc6b6a.tar.gz tcl-c0c51affb865f307ac0588533c21a70380cc6b6a.tar.bz2 |
* generic/tclStringObj.c: Test stringObj-6.9 checks that
* tests/stringObj.test: Tcl_AppendStringsToObj() no longer
crashes when operating on a pure unicode value. [Bug 2597185]
FossilOrigin-Name: 6c175deb9d5f24593b63545f5f680dd0542ded36
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8d5bb6f..32197a7 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.32.2.6 2009/02/05 14:10:58 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.32.2.7 2009/03/21 02:53:18 dgp Exp $ */ #include "tclInt.h" @@ -1473,6 +1473,13 @@ Tcl_AppendStringsToObjVA (objPtr, argList) SetStringFromAny(NULL, objPtr); /* + * Force the existence of a string rep. so we avoid crashes operating + * on a pure unicode value. [Bug 2597185] + */ + + (void) Tcl_GetStringFromObj(objPtr, &oldLength); + + /* * Figure out how much space is needed for all the strings, and * expand the string representation if it isn't big enough. If no * bytes would be appended, just return. Note that on some platforms @@ -1481,7 +1488,6 @@ Tcl_AppendStringsToObjVA (objPtr, argList) nargs = 0; newLength = 0; - oldLength = objPtr->length; while (1) { string = va_arg(argList, char *); if (string == NULL) { |