mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:27:46 +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:
parent
a84e64ed22
commit
da394abe04
37 changed files with 125 additions and 105 deletions
|
@ -143,19 +143,19 @@ void SpiceAgent::on_message_received()
|
|||
if (type == ClipboardType::PNG) {
|
||||
if (Gfx::PNGImageDecoderPlugin::sniff({ data_buffer.data(), data_buffer.size() })) {
|
||||
auto png_decoder = Gfx::PNGImageDecoderPlugin::create({ data_buffer.data(), data_buffer.size() }).release_value_but_fixme_should_propagate_errors();
|
||||
if (png_decoder->initialize())
|
||||
if (!png_decoder->initialize().is_error())
|
||||
frame_or_error = png_decoder->frame(0);
|
||||
}
|
||||
} else if (type == ClipboardType::BMP) {
|
||||
if (Gfx::BMPImageDecoderPlugin::sniff({ data_buffer.data(), data_buffer.size() })) {
|
||||
auto bmp_decoder = Gfx::BMPImageDecoderPlugin::create({ data_buffer.data(), data_buffer.size() }).release_value_but_fixme_should_propagate_errors();
|
||||
if (bmp_decoder->initialize())
|
||||
if (!bmp_decoder->initialize().is_error())
|
||||
frame_or_error = bmp_decoder->frame(0);
|
||||
}
|
||||
} else if (type == ClipboardType::JPEG) {
|
||||
if (Gfx::JPEGImageDecoderPlugin::sniff({ data_buffer.data(), data_buffer.size() })) {
|
||||
auto jpeg_decoder = Gfx::JPEGImageDecoderPlugin::create({ data_buffer.data(), data_buffer.size() }).release_value_but_fixme_should_propagate_errors();
|
||||
if (jpeg_decoder->initialize())
|
||||
if (!jpeg_decoder->initialize().is_error())
|
||||
frame_or_error = jpeg_decoder->frame(0);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue