aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/big.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-01-22 16:24:48 +0100
committerSverker Eriksson <[email protected]>2014-01-22 16:24:48 +0100
commitaf0227d7591bde8927ea95c93cbadee6b812b1d9 (patch)
tree023db83bb756fa0991ecd7e7e50b40a098e31726 /erts/emulator/beam/big.c
parent1b904fd1fcec000efb33446859e75872dc00ef2b (diff)
downloadotp-af0227d7591bde8927ea95c93cbadee6b812b1d9.tar.gz
otp-af0227d7591bde8927ea95c93cbadee6b812b1d9.tar.bz2
otp-af0227d7591bde8927ea95c93cbadee6b812b1d9.zip
erts: Fix crash when comparing very large floats with integers
big_buf was one word too short on 32-bit emulators causing memory corruption. Seems like this did not cause a problem before the ESTACK memory layout was changed in 172ebf11dc455e22b87f.
Diffstat (limited to 'erts/emulator/beam/big.c')
-rw-r--r--erts/emulator/beam/big.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 4343c6cb4c..41a041eba6 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1607,7 +1607,7 @@ big_to_double(Wterm x, double* resp)
* HALFWORD: Return relative term with 'heap' as base.
*/
Eterm
-double_to_big(double x, Eterm *heap)
+double_to_big(double x, Eterm *heap, Uint hsz)
{
int is_negative;
int ds;
@@ -1638,6 +1638,7 @@ double_to_big(double x, Eterm *heap)
res = make_big_rel(hp, heap);
xp = (ErtsDigit*) (hp + 1);
+ ASSERT(ds < hsz);
for (i = ds - 1; i >= 0; i--) {
ErtsDigit d;