mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
animencoder_fuzzer: fix error check w/Nallocfuzz
WebPAnimEncoderAdd() may fail due to muxer errors that are reported as booleans. When running under the nallocfuzz engine, ignore all failures. Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz). Change-Id: I36589545d20ac30a67f7e09264146db085dee6ca
This commit is contained in:
parent
e94b36d66d
commit
a71ce1cf74
@ -109,7 +109,14 @@ int AddFrame(WebPAnimEncoder** const enc,
|
||||
const WebPEncodingError error_code = pic.error_code;
|
||||
WebPAnimEncoderDelete(*enc);
|
||||
WebPPictureFree(&pic);
|
||||
if (error_code == VP8_ENC_ERROR_OUT_OF_MEMORY) return 0;
|
||||
// Tolerate failures when running under the nallocfuzz engine as
|
||||
// WebPAnimEncoderAdd() may fail due to memory allocation errors outside of
|
||||
// the encoder; in muxer functions that return booleans for instance.
|
||||
if (error_code == VP8_ENC_ERROR_OUT_OF_MEMORY ||
|
||||
error_code == VP8_ENC_ERROR_BAD_WRITE ||
|
||||
getenv("NALLOC_FUZZ_VERSION") != nullptr) {
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "WebPEncode failed. Error code: %d\n", error_code);
|
||||
abort();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user