diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-01 17:02:02 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-01 17:02:02 (GMT) |
| commit | 67319477f132908fc3f5241bece926457d7d4a5e (patch) | |
| tree | d15632fd6eba5c7e646b8bfc737f072cfaef5e3a | |
| parent | 026e32d86a8119bac99953394dffdfd5a80665e9 (diff) | |
| download | tcl-67319477f132908fc3f5241bece926457d7d4a5e.zip tcl-67319477f132908fc3f5241bece926457d7d4a5e.tar.gz tcl-67319477f132908fc3f5241bece926457d7d4a5e.tar.bz2 | |
Bug-fix for TIP #502 implementation: Two missing out-of-bound situations in TclIndexEncode(), one for index > MAX_INT, one for index < end-MAX_INT
| -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 ab97461..4b9c120 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -4068,7 +4068,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". |
