diff options
Diffstat (limited to 'scripts/gen-s-parser.py')
-rwxr-xr-x | scripts/gen-s-parser.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index d75be7635..2aa158c59 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -708,6 +708,10 @@ def instruction_parser(): printer.print_line("auto op = *keyword;") printer.print_line("char buf[{}] = {{}};".format(inst_length + 1)) + printer.print_line("// Ensure we do not copy more than the buffer can hold") + printer.print_line("if (op.size() >= sizeof(buf)) {") + printer.print_line(" goto parse_error;") + printer.print_line("}") printer.print_line("memcpy(buf, op.data(), op.size());") def print_leaf(expr, inst): @@ -754,9 +758,11 @@ def instruction_parser(): def print_header(): print("// DO NOT EDIT! This file generated by scripts/gen-s-parser.py\n") print("// clang-format off\n") + print("// NOLINTBEGIN\n") def print_footer(): + print("\n// NOLINTEND") print("\n// clang-format on") |