From 3ae20774096ddb42ea03142d0c55f9564da4ba50 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 18 Feb 2024 22:01:29 +0300 Subject: Fix runtime error in regmask printing routine --- src/disasm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/disasm.cpp b/src/disasm.cpp index be4a9a8..3a27400 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -1791,7 +1791,9 @@ static size_t snprint_reg_mask( size_t span = 0; // 17-th bit used to close the span with 0 value unconditionally for (int i = 0; i < 17; i++) { - const uint32_t mask = 1 << (arg_type == ArgType::kRegMaskPredecrement ? (15 - i) : i); + const uint32_t mask = (i <= 15) + ? (1 << ((arg_type == ArgType::kRegMaskPredecrement) ? (15 - i) : i)) + : 0; const bool hit = regmask & mask; const bool span_open = hit && span == 0; const bool span_closed = !hit && span > 1; -- cgit v1.2.3