Skip to content

Commit 70f98cb

Browse files
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>
1 parent bc621a9 commit 70f98cb

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

include/CLI/impl/App_inl.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,8 @@ App::_parse_arg(std::vector<std::string> &args, detail::Classifier current_type,
19741974
}
19751975
std::string dummy1, dummy2;
19761976
bool val = false;
1977-
if(current_type == detail::Classifier::SHORT || detail::split_long(args.back(), dummy1, dummy2)) {
1977+
if((current_type == detail::Classifier::SHORT && detail::valid_first_char(args.back()[1])) ||
1978+
detail::split_long(args.back(), dummy1, dummy2)) {
19781979
val = sub->_parse_arg(args, current_type, true);
19791980
}
19801981

tests/FuzzFailTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ TEST_CASE("app_roundtrip_parse_normal_fail") {
341341
// like HorribleErrors
342342
CLI::FuzzApp fuzzdata;
343343
auto app = fuzzdata.generateApp();
344-
int index = GENERATE(range(1, 3));
344+
int index = GENERATE(range(1, 4));
345345
std::string optionString, flagString;
346346
auto parseData = loadFailureFile("parse_fail_check", index);
347347
std::size_t pstring_start{0};

tests/fuzzFail/parse_fail_check3

24 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)