diff options
author | aspect <aspect+tclcore@abstracted-spleen.org> | 2017-02-13 12:24:25 (GMT) |
---|---|---|
committer | aspect <aspect+tclcore@abstracted-spleen.org> | 2017-02-13 12:24:25 (GMT) |
commit | 23817ae8722394a75cbeaa82c6c576933543a2be (patch) | |
tree | f71784e62e5b5d93a2c9264e590b4ba8022a0432 | |
parent | 304de510732b5bf301c6d97ca26f876dca26886e (diff) | |
download | tcl-bug_96c3f3b47d1.zip tcl-bug_96c3f3b47d1.tar.gz tcl-bug_96c3f3b47d1.tar.bz2 |
Tcl_GetWideIntFromObj must fail for values between WIDE_MAX+1 and UWIDE_MAX (bug [96c3f3b47d1])bug_96c3f3b47d1
-rw-r--r-- | generic/tclObj.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 5b11071..fe51558 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3089,12 +3089,16 @@ Tcl_GetWideIntFromObj( while (numBytes-- > 0) { value = (value << CHAR_BIT) | *bytes++; } - if (big.sign) { - *wideIntPtr = - (Tcl_WideInt) value; + if ( (!big.sign) && ((Tcl_WideInt)value < 0) ) { + /* signed overflow - fall through to produce an error */ } else { - *wideIntPtr = (Tcl_WideInt) value; + if (big.sign) { + *wideIntPtr = - (Tcl_WideInt) value; + } else { + *wideIntPtr = (Tcl_WideInt) value; + } + return TCL_OK; } - return TCL_OK; } } if (interp != NULL) { |