diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-16 16:10:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-16 16:10:22 (GMT) |
commit | 247cb91a652499e2b90c89568c3995206148c28c (patch) | |
tree | d37a61a4799f8e3492fc72afc332311aac68fd0a /generic | |
parent | d203d159b9f52796cd28cad53f0c6d777caadf11 (diff) | |
download | tcl-247cb91a652499e2b90c89568c3995206148c28c.zip tcl-247cb91a652499e2b90c89568c3995206148c28c.tar.gz tcl-247cb91a652499e2b90c89568c3995206148c28c.tar.bz2 |
Fix [1c60dca341]: signed integer overflow in Tcl_SetBignumObj()
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclObj.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 029d3c0..f7bb44c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2816,7 +2816,7 @@ Tcl_GetLongFromObj( value = (value << CHAR_BIT) | *bytes++; } if (big.sign) { - *longPtr = (long) (0-value); + *longPtr = (long) (-value); } else { *longPtr = (long) value; } @@ -3116,7 +3116,7 @@ Tcl_GetWideIntFromObj( value = (value << CHAR_BIT) | *bytes++; } if (big.sign) { - *wideIntPtr = (Tcl_WideInt) (0-value); + *wideIntPtr = (Tcl_WideInt) (-value); } else { *wideIntPtr = (Tcl_WideInt) value; } @@ -3547,7 +3547,7 @@ Tcl_SetBignumObj( goto tooLargeForLong; } if (bignumValue->sign) { - TclSetLongObj(objPtr, -(long)value); + TclSetLongObj(objPtr, (long)(-value)); } else { TclSetLongObj(objPtr, (long)value); } @@ -3573,7 +3573,7 @@ Tcl_SetBignumObj( goto tooLargeForWide; } if (bignumValue->sign) { - TclSetWideIntObj(objPtr, -(Tcl_WideInt)value); + TclSetWideIntObj(objPtr, (Tcl_WideInt)(-value)); } else { TclSetWideIntObj(objPtr, (Tcl_WideInt)value); } |