From b5565d9a6b7f7527969246adda52bd757438a8ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 8 Oct 2021 06:37:18 +0200 Subject: Improve argument testing in the bs_add instruction Immediate non-integer values (such as atoms) would not be rejected by bs_add (in the x86 JIT). Therefore, a binary would be allocated, before failing the operation when attempting to fill in the contents of the binary. --- erts/emulator/beam/jit/x86/instr_bs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erts/emulator/beam/jit/x86/instr_bs.cpp b/erts/emulator/beam/jit/x86/instr_bs.cpp index 7df0b84cae..6e9fc79751 100644 --- a/erts/emulator/beam/jit/x86/instr_bs.cpp +++ b/erts/emulator/beam/jit/x86/instr_bs.cpp @@ -1407,8 +1407,8 @@ void BeamModuleAssembler::emit_bs_add(const ArgVal &Fail, a.and_(RETd, ARG1d); } } - a.and_(RETb, imm(_TAG_PRIMARY_MASK)); - a.cmp(RETb, imm(TAG_PRIMARY_IMMED1)); + a.and_(RETb, imm(_TAG_IMMED1_MASK)); + a.cmp(RETb, imm(_TAG_IMMED1_SMALL)); a.jne(fail); /* Verify that ARG2 >= 0 and multiply ARG2 by the unit. The -- cgit v1.2.1