serenity/Ladybird/ImageCodecPlugin.h
Lucas CHOLLET 5c7e5cc738 Ladybird: Decode images out of process
This patch brings a service to handle image decompression. With it comes
security enhancement due to the process boundary. Indeed, consequences
of a potential attack is reduced as only the decoder will crash without
perturbing the WebContent process.
It also allows us to display pages containing images that we claim to
support but still make us crash, like for not-finished-yet decoders.

As an example, we can now load https://jpegxl.info/jxl-art.html without
crashing the WebContent process.
2023-10-27 07:26:32 +02:00

27 lines
604 B
C++

/*
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibImageDecoderClient/Client.h>
#include <LibWeb/Platform/ImageCodecPlugin.h>
namespace Ladybird {
class ImageCodecPlugin final : public Web::Platform::ImageCodecPlugin {
public:
ImageCodecPlugin() = default;
virtual ~ImageCodecPlugin() override;
virtual Optional<Web::Platform::DecodedImage> decode_image(ReadonlyBytes data) override;
private:
RefPtr<ImageDecoderClient::Client> m_client;
};
}