mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGfx/JPEG: Propagate errors when creating JPEGLoadingContext
This allows the JPEG fuzzer to make progress.
This commit is contained in:
parent
a42d849ec1
commit
9ed8c0b183
Notes:
sideshowbarker
2024-07-17 00:23:42 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/9ed8c0b183 Pull-request: https://github.com/SerenityOS/serenity/pull/21674 Reviewed-by: https://github.com/LucasChollet ✅ Reviewed-by: https://github.com/gmta ✅
2 changed files with 6 additions and 5 deletions
|
@ -1926,9 +1926,9 @@ static ErrorOr<void> decode_jpeg(JPEGLoadingContext& context)
|
|||
return {};
|
||||
}
|
||||
|
||||
JPEGImageDecoderPlugin::JPEGImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream> stream)
|
||||
JPEGImageDecoderPlugin::JPEGImageDecoderPlugin(NonnullOwnPtr<JPEGLoadingContext> context)
|
||||
: m_context(move(context))
|
||||
{
|
||||
m_context = JPEGLoadingContext::create(move(stream)).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
JPEGImageDecoderPlugin::~JPEGImageDecoderPlugin() = default;
|
||||
|
@ -1949,7 +1949,8 @@ bool JPEGImageDecoderPlugin::sniff(ReadonlyBytes data)
|
|||
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> JPEGImageDecoderPlugin::create(ReadonlyBytes data)
|
||||
{
|
||||
auto stream = TRY(try_make<FixedMemoryStream>(data));
|
||||
auto plugin = TRY(adopt_nonnull_own_or_enomem(new (nothrow) JPEGImageDecoderPlugin(move(stream))));
|
||||
auto context = TRY(JPEGLoadingContext::create(move(stream)));
|
||||
auto plugin = TRY(adopt_nonnull_own_or_enomem(new (nothrow) JPEGImageDecoderPlugin(move(context))));
|
||||
TRY(decode_header(*plugin->m_context));
|
||||
return plugin;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ public:
|
|||
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
||||
|
||||
private:
|
||||
JPEGImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
|
||||
JPEGImageDecoderPlugin(NonnullOwnPtr<JPEGLoadingContext>);
|
||||
|
||||
OwnPtr<JPEGLoadingContext> m_context;
|
||||
NonnullOwnPtr<JPEGLoadingContext> m_context;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue