Fuzzers: Bail from ASN1 fuzzer on malformed input
Previously, the return value of `drop()` wasn't being checked, so malformed input could cause `drop()` to fail and reading of further bytes to stall, leading to an infinite loop.
This commit is contained in:
parent
a241c31d61
commit
a8d729ff9c
1 changed files with 4 additions and 2 deletions
|
|
@ -13,8 +13,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
|||
AK::set_debug_enabled(false);
|
||||
|
||||
Crypto::ASN1::Decoder decoder(ReadonlyBytes { data, size });
|
||||
while (!decoder.eof())
|
||||
(void)decoder.drop();
|
||||
while (!decoder.eof()) {
|
||||
if (decoder.drop().is_error())
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue