From bb7390261a7b84669129a23643cd21fd022702d7 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Tue, 15 Dec 2020 22:07:31 +1100 Subject: [PATCH] Have gif_fuzzer sometimes use a BGRA_PREMUL dst --- fuzz/c/std/gif_fuzzer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fuzz/c/std/gif_fuzzer.c b/fuzz/c/std/gif_fuzzer.c index 5c483f8d..e8950a4b 100644 --- a/fuzz/c/std/gif_fuzzer.c +++ b/fuzz/c/std/gif_fuzzer.c @@ -74,6 +74,7 @@ fuzz(wuffs_base__io_buffer* src, uint64_t hash) { &dec, sizeof dec, WUFFS_VERSION, (hash & 1) ? WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED : 0); + hash >>= 1; if (!wuffs_base__status__is_ok(&status)) { ret = wuffs_base__status__message(&status); goto exit; @@ -90,6 +91,16 @@ fuzz(wuffs_base__io_buffer* src, uint64_t hash) { goto exit; } + // 50% of the time, choose BGRA_PREMUL instead of the native pixel config. + if (hash & 1) { + wuffs_base__pixel_config__set( + &ic.pixcfg, WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL, + WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, + wuffs_base__pixel_config__width(&ic.pixcfg), + wuffs_base__pixel_config__height(&ic.pixcfg)); + } + hash >>= 1; + // Wuffs allows either statically or dynamically allocated work buffers. // This program exercises dynamic allocation. uint64_t n = wuffs_gif__decoder__workbuf_len(&dec).max_incl;