Skip to content

Commit

Permalink
Validate Zvl ISA string correctly
Browse files Browse the repository at this point in the history
See #1810 for explanation of how this can go wrong.

Resolves #1810
  • Loading branch information
aswaterman committed Sep 20, 2024
1 parent bfe9173 commit 6b74bd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion disasm/isa_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
} catch (std::logic_error& e) {
new_vlen = 0;
}
if ((new_vlen & (new_vlen - 1)) != 0 || new_vlen < 32)
if ((new_vlen & (new_vlen - 1)) != 0 || new_vlen < 32 || ext_str.back() != 'b')
bad_isa_string(str, ("Invalid Zvl string: " + ext_str).c_str());
vlen = std::max(vlen, new_vlen);
} else if (ext_str.substr(0, 3) == "zve") {
Expand Down

0 comments on commit 6b74bd6

Please sign in to comment.