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:
Tim Ledbetter 2026-06-05 12:52:33 +01:00 committed by Tim Ledbetter
parent a241c31d61
commit a8d729ff9c

View file

@ -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;
}