aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-08-18 15:50:30 +0200
committerBjörn Gustavsson <[email protected]>2017-08-23 05:57:38 +0200
commit961f96e9c7c4ad0b64bc6c88700c6eedd30162b5 (patch)
treed714c87cc91c523dbd550bef0dcf81e5df3dca30
parentacad85c9831452e5865f2bd3fdd31455b493f091 (diff)
downloadotp-961f96e9c7c4ad0b64bc6c88700c6eedd30162b5.tar.gz
otp-961f96e9c7c4ad0b64bc6c88700c6eedd30162b5.tar.bz2
otp-961f96e9c7c4ad0b64bc6c88700c6eedd30162b5.zip
beam_makeops: Prevent truncation when packing 'I' values
BEAM_WIDE_MASK covered the 16 right-most bits, instead of the 32 right-most bits. This bug will bite us when we'll do more packing in the future. This bug has been harmless in the past. It has been used in test_heap and allocate instructions for the number of heap words needed. It would be theoretically possible to construct a program that would need 65536 or more heap words, but it is hard to imagine a practical use for such a program. (The program would have to build a tuple or list with at least one variable and the rest of the elements being literals.)
-rwxr-xr-xerts/emulator/utils/beam_makeops2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index f9e22444f3..c3ff7bf31f 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -705,7 +705,7 @@ sub emulator_output {
print "#if !defined(ARCH_64)\n";
print qq[ #error "64-bit architecture assumed, but ARCH_64 not defined"\n];
print "#endif\n";
- print "#define BEAM_WIDE_MASK 0xFFFFUL\n";
+ print "#define BEAM_WIDE_MASK 0xFFFFFFFFUL\n";
print "#define BEAM_LOOSE_MASK 0xFFFFUL\n";
print "#define BEAM_TIGHT_MASK 0xFFFFUL\n";
print "#define BEAM_WIDE_SHIFT 32\n";