From 961f96e9c7c4ad0b64bc6c88700c6eedd30162b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 18 Aug 2017 15:50:30 +0200 Subject: 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.) --- erts/emulator/utils/beam_makeops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts/emulator/utils') 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"; -- cgit v1.2.3