Skip to content

Commit

Permalink
Fix out-of-bounds array access for option characters >= 128 (#3151)
Browse files Browse the repository at this point in the history
Bug found by fuzzing.
  • Loading branch information
josh11b authored Aug 24, 2023
1 parent 0ff5e42 commit f790a27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/command_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,8 @@ auto Parser::ParseShortOptionSeq(llvm::StringRef unparsed_arg) -> bool {
}

for (unsigned char c : unparsed_arg) {
auto* arg_entry = short_option_table_[c];
auto* arg_entry =
(c < short_option_table_.size()) ? short_option_table_[c] : nullptr;
if (!arg_entry) {
errors_ << "ERROR: Unknown short option '" << c << "'\n";
return false;
Expand Down
Binary file not shown.

0 comments on commit f790a27

Please sign in to comment.