summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-07-26 21:56:34 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-07-26 21:56:34 (GMT)
commit420e232f0fb6221fb1473b08681d9b2a76804690 (patch)
tree725277dd32485ba803542bc6c6d9cfbdf15557c8 /generic
parent7bef47d44562d1078457fd681f39a40e54d43897 (diff)
downloadtcl-420e232f0fb6221fb1473b08681d9b2a76804690.zip
tcl-420e232f0fb6221fb1473b08681d9b2a76804690.tar.gz
tcl-420e232f0fb6221fb1473b08681d9b2a76804690.tar.bz2
* generic/tclExecute.c: Corrected flawed overflow detection in
* tests/expr.test: INST_EXPON that caused [expr 2**64] to return 0 instead of the same value as [expr 1<<64].
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 0870219..5e12c95 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.239 2006/07/21 10:47:18 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.240 2006/07/26 21:56:34 dgp Exp $
*/
#include "tclInt.h"
@@ -4858,7 +4858,7 @@ TclExecuteByteCode(
w2 /= 2;
for (; w2>Tcl_LongAsWide(1) ; w1*=w1,w2/=2) {
wasNegative = (wResult < 0);
- if (w1 < 0) {
+ if (w1 <= 0) {
goto overflow;
}
if (w2 & 1) {
@@ -4869,6 +4869,9 @@ TclExecuteByteCode(
}
}
wasNegative = (wResult < 0);
+ if (w1 <= 0) {
+ goto overflow;
+ }
wResult *= w1;
if (wasNegative != (wResult < 0)) {
goto overflow;