1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 12:13:52 +00:00

fuzzer failure --sub1.- interpreting as a short option (#1148)

and getting into odd situations

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Philip Top 2025-04-15 18:44:49 -07:00 committed by GitHub
parent bc621a95ca
commit 70f98cb218
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -1974,7 +1974,8 @@ App::_parse_arg(std::vector<std::string> &args, detail::Classifier current_type,
}
std::string dummy1, dummy2;
bool val = false;
if(current_type == detail::Classifier::SHORT || detail::split_long(args.back(), dummy1, dummy2)) {
if((current_type == detail::Classifier::SHORT && detail::valid_first_char(args.back()[1])) ||
detail::split_long(args.back(), dummy1, dummy2)) {
val = sub->_parse_arg(args, current_type, true);
}

View File

@ -341,7 +341,7 @@ TEST_CASE("app_roundtrip_parse_normal_fail") {
// like HorribleErrors
CLI::FuzzApp fuzzdata;
auto app = fuzzdata.generateApp();
int index = GENERATE(range(1, 3));
int index = GENERATE(range(1, 4));
std::string optionString, flagString;
auto parseData = loadFailureFile("parse_fail_check", index);
std::size_t pstring_start{0};

Binary file not shown.