🔨 fixed fuzz code to avoid false positives in case of discarded values

This commit is contained in:
Niels Lohmann 2018-10-24 18:55:08 +02:00
parent e2c5913a50
commit 4d1eaace8c
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69

View file

@ -33,6 +33,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
std::vector<uint8_t> vec1(data, data + size); std::vector<uint8_t> vec1(data, data + size);
json j1 = json::from_bson(vec1); json j1 = json::from_bson(vec1);
if (j1.is_discarded())
{
return 0;
}
try try
{ {
// step 2: round trip // step 2: round trip