Add a check to prevent cairo from immediately crashing (#4992)

This commit is contained in:
Google AutoFuzz Team 2021-01-18 22:17:06 +01:00 committed by GitHub
parent 613d735dc7
commit 0ba7eeef2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
cairo_surface_t *surface;
cairo_status_t status;
if (size == 0) {
return 0;
}
char *tmpfile = fuzzer_get_tmpfile(data, size);
surface = cairo_pdf_surface_create(tmpfile, width_in_points, height_in_points);
status = cairo_surface_status(surface);