summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-11-25 21:24:06 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-11-25 21:24:06 (GMT)
commit61855b36b423d2293d99ccb6381e6622980e2cd9 (patch)
tree2adc45c2f7b7ddaada73b165f929d598dba94c5b
parent51acb4e23f6c50b6cd0029ab6503034ce76bea05 (diff)
downloadtcl-61855b36b423d2293d99ccb6381e6622980e2cd9.zip
tcl-61855b36b423d2293d99ccb6381e6622980e2cd9.tar.gz
tcl-61855b36b423d2293d99ccb6381e6622980e2cd9.tar.bz2
One way to fix the parser of $-substitution accepting non-ASCII varnames.
-rw-r--r--generic/tclParse.c3
-rw-r--r--tests/parse.test3
2 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index e475fb8..1523eb3 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -1438,6 +1438,9 @@ Tcl_ParseVarName(
offset = Tcl_UtfToUniChar(utfBytes, &ch);
}
c = UCHAR(ch);
+ if (c != ch) {
+ break;
+ }
if (isalnum(c) || (c == '_')) { /* INTL: ISO only, UCHAR. */
src += offset;
numBytes -= offset;
diff --git a/tests/parse.test b/tests/parse.test
index d7de5ff..cd02386 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -656,6 +656,9 @@ test parse-12.24 {Tcl_ParseVarName procedure, missing close paren in array refer
test parse-12.25 {Tcl_ParseVarName procedure, nested array reference} testparser {
testparser {$x(a$y(b$z))} 0
} {- {$x(a$y(b$z))} 1 word {$x(a$y(b$z))} 8 variable {$x(a$y(b$z))} 7 text x 0 text a 0 variable {$y(b$z)} 4 text y 0 text b 0 variable {$z} 1 text z 0 {}}
+test parse-12.26 {Tcl_ParseVarName [d2ffcca163] non-ascii} testparser {
+ testparser "$\u0433" -1
+} "- {$\u0433} 1 word {$\u0433} 2 text {$} 0 text \u0433 0 {}"
test parse-13.1 {Tcl_ParseVar procedure} testparsevar {
set abc 24