Skip to content

Commit 230e9b2

Browse files
committed
Fix fuzzer off by one error
Currently the fuzzer has an off by one error, as it passing a bad length to the CharReader::parse method, resulting in a heap buffer overflow.
1 parent 2ee3b1d commit 230e9b2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: src/test_lib_json/fuzz.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
2525

2626
uint32_t hash_settings = *(const uint32_t*)data;
2727
data += sizeof(uint32_t);
28+
size -= sizeof(uint32_t);
2829

2930
builder.settings_["failIfExtra"] = hash_settings & (1 << 0);
3031
builder.settings_["allowComments_"] = hash_settings & (1 << 1);

0 commit comments

Comments
 (0)