diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-12 08:02:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-12 08:02:23 (GMT) |
commit | 860e6b5e43e0ac7e673218dd929d425c5d206014 (patch) | |
tree | 37151f179ef8cad02889b0ddf4a07163698782df /generic/tclParse.c | |
parent | ba9424ed9813043dd8948d59a0fd5aa83b0cd0ca (diff) | |
download | tcl-860e6b5e43e0ac7e673218dd929d425c5d206014.zip tcl-860e6b5e43e0ac7e673218dd929d425c5d206014.tar.gz tcl-860e6b5e43e0ac7e673218dd929d425c5d206014.tar.bz2 |
TIP 388 implementation
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 2b0dab4..3c984bf 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -754,7 +754,7 @@ TclParseHex( while (numBytes--) { unsigned char digit = UCHAR(*p); - if (!isxdigit(digit)) { + if (!isxdigit(digit) || (result > 0x10fff)) { break; } @@ -866,7 +866,7 @@ TclParseBackslash( result = 0xb; break; case 'x': - count += TclParseHex(p+1, numBytes-2, &result); + count += TclParseHex(p+1, (numBytes > 3) ? 2 : numBytes-2, &result); if (count == 2) { /* * No hexadigits -> This is just "x". @@ -889,6 +889,15 @@ TclParseBackslash( result = 'u'; } break; + case 'U': + count += TclParseHex(p+1, (numBytes > 9) ? 8 : numBytes-2, &result); + if (count == 2) { + /* + * No hexadigits -> This is just "U". + */ + result = 'U'; + } + break; case '\n': count--; do { @@ -917,7 +926,7 @@ TclParseBackslash( result = (result << 3) + (*p - '0'); p++; if ((numBytes == 3) || !isdigit(UCHAR(*p)) /* INTL: digit */ - || (UCHAR(*p) >= '8')) { + || (UCHAR(*p) >= '8') || (result >= 0x20)) { break; } count = 4; |