Skip to content

Commit 56ba1af

Browse files
committed
Bug [8dd2807066] - crash on expr(max(abs())
1 parent 1a9fab7 commit 56ba1af

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

generic/tclExecute.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8765,6 +8765,13 @@ TclCompareTwoNumbers(
87658765
double d1, d2, tmp;
87668766
Tcl_WideInt w1, w2;
87678767

8768+
if (valuePtr == value2Ptr) {
8769+
/*
8770+
* Bug https://core.tcl-lang.org/tcl/tktview/8dd28070. Protect
8771+
* multiple mp_clear's of the same bignum.
8772+
*/
8773+
return MP_EQ;
8774+
}
87688775
(void) GetNumberFromObj(NULL, valuePtr, &ptr1, &type1);
87698776
(void) GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2);
87708777

tests/expr.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7456,6 +7456,10 @@ test expr-62.10 {TIP 582: comments can go inside function calls} {
74567456
(1,2)}
74577457
} 2
74587458

7459+
test expr-bug-8dd2807066 {Bug 8dd2807066} {
7460+
expr {max(abs(-668336881543038127783364011867))}
7461+
} 668336881543038127783364011867
7462+
74597463
# Bug e3dcab1d14 TODO: Need to work out a test case that fails
74607464
# without tcl_precision, which has been eliminated in 9.0
74617465

0 commit comments

Comments
 (0)