mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
enc_dec_fuzzer: fix WebPEncode/pic.error_code check
pic.error_code may be set to VP8_ENC_ERROR_BAD_WRITE if the writer fails due to a memory allocation failure. Found by Nallocfuzz (https://github.com/catenacyber/nallocfuzz). Change-Id: I912c9e5f9a37b78832c52d9ab6f0710967fbadac
This commit is contained in:
parent
982c177c8a
commit
0fcb311cfc
@ -91,7 +91,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
|
|||||||
const WebPEncodingError error_code = pic.error_code;
|
const WebPEncodingError error_code = pic.error_code;
|
||||||
WebPMemoryWriterClear(&memory_writer);
|
WebPMemoryWriterClear(&memory_writer);
|
||||||
WebPPictureFree(&pic);
|
WebPPictureFree(&pic);
|
||||||
if (error_code == VP8_ENC_ERROR_OUT_OF_MEMORY) return 0;
|
if (error_code == VP8_ENC_ERROR_OUT_OF_MEMORY ||
|
||||||
|
error_code == VP8_ENC_ERROR_BAD_WRITE) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
fprintf(stderr, "WebPEncode failed. Error code: %d\n", error_code);
|
fprintf(stderr, "WebPEncode failed. Error code: %d\n", error_code);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user