diff options
author | Oxore <oxore@protonmail.com> | 2024-02-18 22:01:29 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2024-02-18 22:01:29 +0300 |
commit | 3ae20774096ddb42ea03142d0c55f9564da4ba50 (patch) | |
tree | 989e1c6c4e28996ba61250c935b563896c512e8a | |
parent | fec4c1684e8680285f51ebd4898fe35127c7e098 (diff) |
Fix runtime error in regmask printing routine
-rw-r--r-- | src/disasm.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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; |