diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-02-27 21:29:43 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-02-27 21:29:43 (GMT) |
commit | 050b6c3d5f632fea7bf549688c54be65fba7bee2 (patch) | |
tree | 007b045355fdadddb97c53f8d0d714ef29a351ed /generic/tclExecute.c | |
parent | f04b875d88bbe9cd4d2114d60c194be01a7c9e04 (diff) | |
parent | 57d9952ece8f81fc6802097bace965a196bb849b (diff) | |
download | tcl-050b6c3d5f632fea7bf549688c54be65fba7bee2.zip tcl-050b6c3d5f632fea7bf549688c54be65fba7bee2.tar.gz tcl-050b6c3d5f632fea7bf549688c54be65fba7bee2.tar.bz2 |
Fix [bd94500678e837d7]: SEGFAULT by conversion of unicode (out of BMP) to byte-array
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 717ebf6..e7c003a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5215,7 +5215,7 @@ TEBCresume( objResultPtr = Tcl_NewStringObj((const char *) valuePtr->bytes+index, 1); } else { - char buf[4]; + char buf[TCL_UTF_MAX] = ""; int ch = Tcl_GetUniChar(valuePtr, index); /* @@ -5227,8 +5227,8 @@ TEBCresume( objResultPtr = Tcl_NewObj(); } else { length = Tcl_UniCharToUtf(ch, buf); - if (!length) { - length = Tcl_UniCharToUtf(-1, buf); + if ((ch >= 0xD800) && (length < 3)) { + length += Tcl_UniCharToUtf(-1, buf + length); } objResultPtr = Tcl_NewStringObj(buf, length); } |