summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 2e42e98..3e1df0b 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -578,6 +578,9 @@ Tcl_GetUniChar(
if (stringPtr->numChars == TCL_INDEX_NONE) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
+ if (index >= stringPtr->numChars) {
+ return -1;
+ }
if (stringPtr->numChars == objPtr->length) {
return (unsigned char) objPtr->bytes[index];
}