1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr

This prevents callers from accidentally discarding the result of
initialize(), which was the root cause of this OSS Fuzz bug:

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55896&q=label%3AProj-serenity&sort=summary
This commit is contained in:
Ben Wiederhake 2023-05-07 19:27:07 +02:00 committed by Sam Atkins
parent a84e64ed22
commit da394abe04
37 changed files with 125 additions and 105 deletions

View file

@ -213,7 +213,7 @@ Icon FileIconProvider::icon_for_executable(DeprecatedString const& path)
// FIXME: Use the ImageDecoder service.
if (Gfx::PNGImageDecoderPlugin::sniff({ section->raw_data(), section->size() })) {
auto png_decoder = Gfx::PNGImageDecoderPlugin::create({ section->raw_data(), section->size() }).release_value_but_fixme_should_propagate_errors();
if (png_decoder->initialize()) {
if (!png_decoder->initialize().is_error()) {
auto frame_or_error = png_decoder->frame(0);
if (!frame_or_error.is_error()) {
bitmap = frame_or_error.value().image;