summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-20 14:29:33 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-21 20:22:48 +0100
commit5a79c69b0216f070b07d8238e4c2c7e3420faeec (patch)
treea88ee6dff60c34b27f383d36a4dfd3ba4b11c482 /Meta/Lagom/Fuzzers
parentae7656072a403f69607109d941aa0c4b6274f60c (diff)
downloadserenity-5a79c69b0216f070b07d8238e4c2c7e3420faeec.zip
LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<>
This is a first step towards better error propagation from image codecs.
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp b/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp
index c713c2234c..948214c8f2 100644
--- a/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp
@@ -14,8 +14,9 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
Gfx::GIFImageDecoderPlugin gif_decoder(data, size);
- auto bitmap = gif_decoder.frame(0).image;
- if (bitmap) {
+ auto bitmap_or_error = gif_decoder.frame(0);
+ if (!bitmap_or_error.is_error()) {
+ auto const& bitmap = bitmap_or_error.value().image;
// Looks like a valid GIF. Try to load the other frames:
dbgln_if(GIF_DEBUG, "bitmap size: {}", bitmap->size());
dbgln_if(GIF_DEBUG, "codec size: {}", gif_decoder.size());
@@ -24,7 +25,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
dbgln_if(GIF_DEBUG, "loop_count: {}", gif_decoder.loop_count());
dbgln_if(GIF_DEBUG, "frame_count: {}", gif_decoder.frame_count());
for (size_t i = 0; i < gif_decoder.frame_count(); ++i) {
- auto ifd = gif_decoder.frame(i);
+ auto ifd = gif_decoder.frame(i).release_value_but_fixme_should_propagate_errors();
dbgln_if(GIF_DEBUG, "frame #{} size: {}", i, ifd.image->size());
dbgln_if(GIF_DEBUG, "frame #{} duration: {}", i, ifd.duration);
}