diff options
author | dgp <dgp@users.sourceforge.net> | 2020-04-14 21:16:43 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-04-14 21:16:43 (GMT) |
commit | 6df0ccf3997e397b860c47c770ba0fc31a2a9961 (patch) | |
tree | 2f463261548bfdf0368e2488cb5f5d59447bac13 /generic/tclCompExpr.c | |
parent | 279c54dbff724a62d6739a9cc71ba31a83325c98 (diff) | |
download | tcl-6df0ccf3997e397b860c47c770ba0fc31a2a9961.zip tcl-6df0ccf3997e397b860c47c770ba0fc31a2a9961.tar.gz tcl-6df0ccf3997e397b860c47c770ba0fc31a2a9961.tar.bz2 |
Replace calls of TclUtfToUniChar() with TclUtfNext() when caller has no
decoding need. Failing test string-22.14 indicates something is still not
quite right.
Now that Tcl_NumUtfChars() is not paying decoding prices, we let it spend
to properly protect against overflow. [2738427]
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r-- | generic/tclCompExpr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 27d7503..42321af 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1801,7 +1801,6 @@ ParseLexeme( { const char *end; int scanned; - Tcl_UniChar ch; Tcl_Obj *literal = NULL; unsigned char byte; @@ -1979,12 +1978,12 @@ ParseLexeme( if (!TclIsBareword(*start) || *start == '_') { if (Tcl_UtfCharComplete(start, numBytes)) { - scanned = Tcl_UtfToUniChar(start, &ch); + scanned = TclUtfNext(start) - start; } else { char utfBytes[TCL_UTF_MAX]; memcpy(utfBytes, start, (size_t) numBytes); utfBytes[numBytes] = '\0'; - scanned = Tcl_UtfToUniChar(utfBytes, &ch); + scanned = TclUtfNext(utfBytes) - utfBytes; } *lexemePtr = INVALID; Tcl_DecrRefCount(literal); |