From 9da335e3b2ce546aaf41238ba53e04bfdeaf3584 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 11 May 2020 18:24:10 +0100 Subject: [PATCH] simplify --- lib/fizzy/parser_expr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/fizzy/parser_expr.cpp b/lib/fizzy/parser_expr.cpp index 1f62ba8bc..6814e6a5c 100644 --- a/lib/fizzy/parser_expr.cpp +++ b/lib/fizzy/parser_expr.cpp @@ -492,8 +492,7 @@ parser_result parse_expr(const uint8_t* pos, const uint8_t* end, const Mod // alignment uint32_t align; std::tie(align, pos) = leb128u_decode(pos, end); - // NOTE: align > 4 is the hard limit (64 / 8) >> 1, and checking it to avoid overflows - if ((align > 4) || ((1 << align) > metrics.memory_width)) + if ((1 << static_cast(align)) > metrics.memory_width) throw validation_error{"alignment can't exceed operand size"}; // offset