mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-27 05:05:32 +03:00
5c7e5cc738
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.
27 lines
604 B
C++
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;
|
|
};
|
|
|
|
}
|