Skip to content

Commit

Permalink
Merge pull request #249 from chaoticgd/command_line_segfault
Browse files Browse the repository at this point in the history
Fix crash in stdump command line argument parser
  • Loading branch information
chaoticgd authored Oct 22, 2024
2 parents 8aaba77 + f109f00 commit 87670a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Mac builds compiled for x64 processors are now provided in addition to the arm64 builds.
- stdump: The `functions` and `globals` subcommands now output a header comment like the `types` command.
- stdump: The output format of the `files` subcommand has been updated.
- stdump: A crash in the command line parser has been fixed.

## v2.1

Expand Down
6 changes: 5 additions & 1 deletion src/stdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,11 @@ static Options parse_command_line_arguments(int argc, char** argv)
if(i + 2 < argc) {
SymbolTableLocation& section = options.sections.emplace_back();
section.section_name = argv[++i];
section.format = symbol_table_format_from_name(argv[++i])->format;

const SymbolTableFormatInfo* info = symbol_table_format_from_name(argv[++i]);
CCC_EXIT_IF_FALSE(info, "Invalid symbol table format specified.");

section.format = info->format;
} else if(i + 1 < argc) {
CCC_EXIT("Missing format after --section.");
} else {
Expand Down

0 comments on commit 87670a6

Please sign in to comment.