summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-07-18 23:35:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-07-18 23:35:37 (GMT)
commitb48c6ea6c1f6c8a6cf870c15799cf33cb88d0b7d (patch)
tree0580485f72aa65d80f29849145a21e23f8252d07 /generic/tclCompile.c
parent7265d5487c6af7a62eb6a02dbb439f996b49e826 (diff)
downloadtcl-b48c6ea6c1f6c8a6cf870c15799cf33cb88d0b7d.zip
tcl-b48c6ea6c1f6c8a6cf870c15799cf33cb88d0b7d.tar.gz
tcl-b48c6ea6c1f6c8a6cf870c15799cf33cb88d0b7d.tar.bz2
* generic/tclBasic.c: Corrected several instances of unsafe
* generic/tclCompile.c: truncation of UTF-8 strings that might * generic/tclProc.c: break apart a multi-byte character. * library/init.tcl: [Bug 760872] * tests/init.test:
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 46628b1..6c619e9 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.43.2.2 2003/04/18 21:54:24 dgp Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.43.2.3 2003/07/18 23:35:38 dgp Exp $
*/
#include "tclInt.h"
@@ -1727,6 +1727,14 @@ LogCompilationInfo(interp, script, command, length)
length = 150;
ellipsis = "...";
}
+ while ( (command[length] & 0xC0) == 0x80 ) {
+ /*
+ * Back up truncation point so that we don't truncate in the
+ * middle of a multi-byte character (in UTF-8)
+ */
+ length--;
+ ellipsis = "...";
+ }
sprintf(buffer, "\n while compiling\n\"%.*s%s\"",
length, command, ellipsis);
Tcl_AddObjErrorInfo(interp, buffer, -1);