🚑 adjusted Fuzzer to new parser

out_of_range exceptions where unexpected before - the parser used to crash in these situations...
This commit is contained in:
Niels Lohmann 2018-05-28 17:57:22 +02:00
parent db03d09312
commit a49644ab74
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
3 changed files with 12 additions and 0 deletions

View file

@ -58,6 +58,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{ {
// type errors can occur during parsing, too // type errors can occur during parsing, too
} }
catch (const json::out_of_range&)
{
// out of range errors can occur during parsing, too
}
// return 0 - non-zero return values are reserved for future use // return 0 - non-zero return values are reserved for future use
return 0; return 0;

View file

@ -63,6 +63,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{ {
// parse errors are ok, because input may be random bytes // parse errors are ok, because input may be random bytes
} }
catch (const json::out_of_range&)
{
// out of range errors may happen if provided sizes are excessive
}
// return 0 - non-zero return values are reserved for future use // return 0 - non-zero return values are reserved for future use
return 0; return 0;

View file

@ -58,6 +58,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{ {
// type errors can occur during parsing, too // type errors can occur during parsing, too
} }
catch (const json::out_of_range&)
{
// out of range errors may happen if provided sizes are excessive
}
// return 0 - non-zero return values are reserved for future use // return 0 - non-zero return values are reserved for future use
return 0; return 0;