mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 12:17:52 +00:00
LibGfx: Support AVIF images with missing pixi property
This commit is contained in:
parent
3fffd1129c
commit
b22341fc77
Notes:
github-actions[bot]
2024-11-23 03:58:54 +00:00
Author: https://github.com/Psychpsyo
Commit: b22341fc77
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2270
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 11 additions and 0 deletions
|
@ -68,6 +68,11 @@ static ErrorOr<void> decode_avif_header(AVIFLoadingContext& context)
|
||||||
if (context.decoder == nullptr) {
|
if (context.decoder == nullptr) {
|
||||||
return Error::from_string_literal("failed to allocate AVIF decoder");
|
return Error::from_string_literal("failed to allocate AVIF decoder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This makes the decoder not error if an item in the file is missing the mandatory pixi property.
|
||||||
|
// Reason for this is that older versions of ImageMagick do not set this property, which leads to
|
||||||
|
// broken web content if the error is not ignored.
|
||||||
|
context.decoder->strictFlags &= ~AVIF_STRICT_PIXI_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
avifResult result = avifDecoderSetIOMemory(context.decoder, context.data.data(), context.data.size());
|
avifResult result = avifDecoderSetIOMemory(context.decoder, context.data.data(), context.data.size());
|
||||||
|
|
|
@ -1067,3 +1067,9 @@ TEST_CASE(test_avif_frame_out_of_bounds)
|
||||||
auto frame1 = TRY_OR_FAIL(plugin_decoder->frame(0));
|
auto frame1 = TRY_OR_FAIL(plugin_decoder->frame(0));
|
||||||
EXPECT(plugin_decoder->frame(1).is_error());
|
EXPECT(plugin_decoder->frame(1).is_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(test_avif_missing_pixi_property)
|
||||||
|
{
|
||||||
|
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("avif/missing-pixi-property.avif"sv)));
|
||||||
|
EXPECT(Gfx::AVIFImageDecoderPlugin::sniff(file->bytes()));
|
||||||
|
}
|
||||||
|
|
BIN
Tests/LibGfx/test-inputs/avif/missing-pixi-property.avif
Normal file
BIN
Tests/LibGfx/test-inputs/avif/missing-pixi-property.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue