mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibGfx: Use libpng's built-in signature verification
This commit is contained in:
parent
0a569a9034
commit
2ce7ec8251
|
|
@ -327,10 +327,10 @@ PNGImageDecoderPlugin::~PNGImageDecoderPlugin() = default;
|
|||
|
||||
bool PNGImageDecoderPlugin::sniff(ReadonlyBytes data)
|
||||
{
|
||||
Array<u8, 8> png_signature { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
|
||||
if (data.size() < png_signature.size())
|
||||
auto constexpr png_signature_size_in_bytes = 8;
|
||||
if (data.size() < png_signature_size_in_bytes)
|
||||
return false;
|
||||
return data.slice(0, png_signature.size()) == ReadonlyBytes(png_signature.data(), png_signature.size());
|
||||
return png_sig_cmp(data.data(), 0, png_signature_size_in_bytes) == 0;
|
||||
}
|
||||
|
||||
Optional<Metadata const&> PNGImageDecoderPlugin::metadata()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user