diff options
-rw-r--r-- | generic/tclUtil.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 1ac2b31..a361ba3 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3751,7 +3751,11 @@ TclIndexEncode( * We parsed an end+offset index value. * wide holds the offset value in the range WIDE_MIN...WIDE_MAX. */ - if (wide > (unsigned)(irPtr ? TCL_INDEX_END : INT_MAX)) { + if (!irPtr && (wide > INT_MAX)) { + return TCL_ERROR; + } else if (irPtr && (wide < INT_MIN)) { + return TCL_ERROR; + } else if (wide > (unsigned)(irPtr ? TCL_INDEX_END : INT_MAX)) { /* * All end+postive or end-negative expressions * always indicate "after the end". |