From a701a5d97fae6ebe265b2135497f598d186b551b Mon Sep 17 00:00:00 2001 From: Psychpsyo Date: Sun, 10 Nov 2024 17:39:40 +0100 Subject: [PATCH] LibGfx: Support AVIF images with missing pixi property --- Libraries/LibGfx/ImageFormats/AVIFLoader.cpp | 5 +++++ .../test-inputs/avif/missing-pixi-property.avif | Bin 0 -> 3315 bytes 2 files changed, 5 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/avif/missing-pixi-property.avif diff --git a/Libraries/LibGfx/ImageFormats/AVIFLoader.cpp b/Libraries/LibGfx/ImageFormats/AVIFLoader.cpp index f10030bbccc..1f68fc3c91b 100644 --- a/Libraries/LibGfx/ImageFormats/AVIFLoader.cpp +++ b/Libraries/LibGfx/ImageFormats/AVIFLoader.cpp @@ -68,6 +68,11 @@ static ErrorOr decode_avif_header(AVIFLoadingContext& context) if (context.decoder == nullptr) { 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()); diff --git a/Tests/LibGfx/test-inputs/avif/missing-pixi-property.avif b/Tests/LibGfx/test-inputs/avif/missing-pixi-property.avif new file mode 100644 index 0000000000000000000000000000000000000000..0c538b1655fd94c5c19d9c4c93b99f0fa331a1aa GIT binary patch literal 3315 zcmXv}1y~bY7apULlI|EWKsp7HkdPQ5NK1?!IbtIe21qL)h|(pXbV(}BB&AVebcb{Z zL*U2n|GxJ;_q_3(`<#0L004udZvY&MggF9k@t56Uj$*fR+TFny`Zv1;r?b7A_x~jT z0EgN6{-^(AayZP_{U3vK+d(ilPrJWPRSAG|TYqu!F9YsiZygs5=JC(Me^T08;{g0S zbvp}1ivC>>FoVIp;kWz%2DkIPWokQ5H*XI+H-7-|wg^IQBT^_*OeK_z^i~3BU_N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