mirror of
https://github.com/CLIUtils/CLI11.git
synced 2026-01-19 04:52:08 +00:00
Fuzzer issues (#1202)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1670,7 +1670,7 @@ CLI11_INLINE bool App::_parse_single_config(const ConfigItem &item, std::size_t
|
||||
throw ConfigError::NotConfigurable(item.fullname());
|
||||
}
|
||||
if(op->empty()) {
|
||||
std::vector<std::string> buffer; // a buffer to use for copying an modifying inputs in a few cases
|
||||
std::vector<std::string> buffer; // a buffer to use for copying and modifying inputs in a few cases
|
||||
bool useBuffer{false};
|
||||
if(item.multiline) {
|
||||
if(!op->get_inject_separator()) {
|
||||
|
||||
@@ -584,8 +584,16 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description,
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string value =
|
||||
detail::ini_join(results, arraySeparator, arrayStart, arrayEnd, stringQuote, literalQuote);
|
||||
std::string value;
|
||||
if(opt->count() == 1 && results.size() == 2 && results.front() == "{}" && results.back() == "%%") {
|
||||
// there is a catch to allow for {} to used as as string in the output
|
||||
// it will append a sequence terminator to the output so the lexical conversion handles it
|
||||
// correctly but that is meant for config files so when outputting for a config file we need to
|
||||
// makes sure to get the correct output
|
||||
value = "\"{}\"";
|
||||
} else {
|
||||
value = detail::ini_join(results, arraySeparator, arrayStart, arrayEnd, stringQuote, literalQuote);
|
||||
}
|
||||
|
||||
bool isDefault = false;
|
||||
if(value.empty() && default_also) {
|
||||
|
||||
@@ -345,7 +345,7 @@ TEST_CASE("app_roundtrip_custom") {
|
||||
CLI::FuzzApp fuzzdata2;
|
||||
auto app = fuzzdata.generateApp();
|
||||
auto app2 = fuzzdata2.generateApp();
|
||||
int index = GENERATE(range(1, 24));
|
||||
int index = GENERATE(range(1, 25));
|
||||
|
||||
auto parseData = loadFailureFile("round_trip_custom", index);
|
||||
|
||||
|
||||
BIN
tests/fuzzFail/round_trip_custom24
Normal file
BIN
tests/fuzzFail/round_trip_custom24
Normal file
Binary file not shown.
Reference in New Issue
Block a user