diff options
-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) { |