diff options
author | Björn Gustavsson <[email protected]> | 2018-12-13 10:26:20 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-12-13 10:26:20 +0100 |
commit | 3e58c9be25dbe9eb5c0cdda31f1b88d41f4d7131 (patch) | |
tree | cca722c99ea6e9a1adf68328294b3377720760c5 /erts/emulator/beam | |
parent | dcf9c02e4674ce7a0e23458be666bc03de6e0160 (diff) | |
parent | 2bf2b7009905a880f514621e8912508055df437e (diff) | |
download | otp-3e58c9be25dbe9eb5c0cdda31f1b88d41f4d7131.tar.gz otp-3e58c9be25dbe9eb5c0cdda31f1b88d41f4d7131.tar.bz2 otp-3e58c9be25dbe9eb5c0cdda31f1b88d41f4d7131.zip |
Merge branch 'maint'
* maint:
Fix reading beyond end of bignum in integer squaring
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/big.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c index 84338769e0..dac9574fa5 100644 --- a/erts/emulator/beam/big.c +++ b/erts/emulator/beam/big.c @@ -668,27 +668,25 @@ static dsize_t I_mul(ErtsDigit* x, dsize_t xl, ErtsDigit* y, dsize_t yl, ErtsDig static dsize_t I_sqr(ErtsDigit* x, dsize_t xl, ErtsDigit* r) { - ErtsDigit d_next = *x; ErtsDigit d; ErtsDigit* r0 = r; ErtsDigit* s = r; if ((r + xl) == x) /* "Inline" operation */ *x = 0; - x++; while(xl--) { - ErtsDigit* y = x; + ErtsDigit* y; ErtsDigit y_0 = 0, y_1 = 0, y_2 = 0, y_3 = 0; ErtsDigit b0, b1; ErtsDigit z0, z1, z2; ErtsDigit t; dsize_t y_l = xl; - + + d = *x; + x++; + y = x; s = r; - d = d_next; - d_next = *x; - x++; DMUL(d, d, b1, b0); DSUMc(*s, b0, y_3, t); |