mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17: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:
parent
a84e64ed22
commit
da394abe04
37 changed files with 125 additions and 105 deletions
|
@ -272,10 +272,9 @@ PDFErrorOr<ByteBuffer> Filter::decode_dct(ReadonlyBytes bytes)
|
|||
{
|
||||
if (Gfx::JPEGImageDecoderPlugin::sniff({ bytes.data(), bytes.size() })) {
|
||||
auto decoder = Gfx::JPEGImageDecoderPlugin::create({ bytes.data(), bytes.size() }).release_value_but_fixme_should_propagate_errors();
|
||||
if (decoder->initialize()) {
|
||||
auto frame = TRY(decoder->frame(0));
|
||||
return TRY(frame.image->serialize_to_byte_buffer());
|
||||
}
|
||||
TRY(decoder->initialize());
|
||||
auto frame = TRY(decoder->frame(0));
|
||||
return TRY(frame.image->serialize_to_byte_buffer());
|
||||
}
|
||||
return AK::Error::from_string_literal("Not a JPEG image!");
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue