summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-23 14:30:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-23 14:30:35 (GMT)
commit9f8ca234489c677193efb409fef485ce4774e8c6 (patch)
tree6c7a3717910e4b345573a52d35c000f429774458
parente3a66ed89821aa0205bac733c8d1a5b45465556f (diff)
downloadtcl-9f8ca234489c677193efb409fef485ce4774e8c6.zip
tcl-9f8ca234489c677193efb409fef485ce4774e8c6.tar.gz
tcl-9f8ca234489c677193efb409fef485ce4774e8c6.tar.bz2
Fix [cb90038a63]: signed integer overflow during expr-34.22, expr-36.22
-rw-r--r--generic/tclExecute.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 97ac1f0..b96eab4 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -6286,7 +6286,8 @@ TEBCresume(
(lResult * l2 != l1)) {
lResult -= 1;
}
- lResult = l1 - l2*lResult;
+ lResult = (long)((unsigned long)l1 -
+ (unsigned long)l2*(unsigned long)lResult);
goto longResultOfArithmetic;
}
break;
@@ -8544,7 +8545,8 @@ ExecuteExtendedBinaryMathOp(
&& (wQuotient * w2 != w1)) {
wQuotient -= (Tcl_WideInt) 1;
}
- wRemainder = w1 - w2*wQuotient;
+ wRemainder = (Tcl_WideInt)((Tcl_WideUInt)w1 -
+ (Tcl_WideUInt)w2*(Tcl_WideUInt)wQuotient);
WIDE_RESULT(wRemainder);
}