diff options
author | sebres <sebres@users.sourceforge.net> | 2018-03-13 18:52:45 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2018-03-13 18:52:45 (GMT) |
commit | 64eaafad72c1c1c0a76fb1adffb7200f79debb04 (patch) | |
tree | 746280001dd5424d8f68eb4bd663069d458aee15 /generic/tclInt.h | |
parent | 6c0170972f57e3d1daf5684c55eccfb2d78b386f (diff) | |
download | tcl-64eaafad72c1c1c0a76fb1adffb7200f79debb04.zip tcl-64eaafad72c1c1c0a76fb1adffb7200f79debb04.tar.gz tcl-64eaafad72c1c1c0a76fb1adffb7200f79debb04.tar.bz2 |
remove unexpected panic by TclTrimLeft/TclTrimRight, handling rewritten:
- instead of check the NTS-byte after string (may cause segfault by access violation if out of range),
it checks now the end-character is well-formed utf8-sequence;
- both work well now on non-NTS strings (without null character at end);
- additionally fixed wrong offsets (trim-length if last char malformed in case of out of range);
new function TclTrim introduced (as combination of TclTrimLeft/TclTrimRight).
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 25bec6a..9d60cbc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2747,6 +2747,8 @@ MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, int *clNextOuter, CONST char *outerScript); MODULE_SCOPE void TclTransferResult(Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); +MODULE_SCOPE int TclTrim(const char *bytes, int numBytes, + const char *trim, int numTrim, int *trimRight); MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes, const char *trim, int numTrim); MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes, |