1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 02:35:23 +03:00
aports/community/libavif/fix-32-bits.patch

28 lines
1.4 KiB
Diff

From 1556f21fb54e24d3612a0782fa0e5c8360bccbb9 Mon Sep 17 00:00:00 2001
From: Wan-Teh Chang <wtc@google.com>
Date: Fri, 23 Jul 2021 15:26:12 -0700
Subject: [PATCH] In 32-bit builds set frame_size_limit to 8192*8192
This avoids the following dav1d_log() message in 32-bit builds:
Frame size limit reduced from 268435456 to 67108864.
---
src/codec_dav1d.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/codec_dav1d.c b/src/codec_dav1d.c
index b063fb09..88808ec6 100644
--- a/src/codec_dav1d.c
+++ b/src/codec_dav1d.c
@@ -215,8 +215,10 @@ avifCodec * avifCodecCreateDav1d(void)
memset(codec->internal, 0, sizeof(struct avifCodecInternal));
dav1d_default_settings(&codec->internal->dav1dSettings);
- // Set a maximum frame size limit to avoid OOM'ing fuzzers.
- codec->internal->dav1dSettings.frame_size_limit = AVIF_MAX_IMAGE_SIZE;
+ // Set a maximum frame size limit to avoid OOM'ing fuzzers. In 32-bit builds, if
+ // frame_size_limit > 8192 * 8192, dav1d reduces frame_size_limit to 8192 * 8192 and logs a
+ // message, so we set frame_size_limit to 8192 * 8192 to avoid the dav1d_log message.
+ codec->internal->dav1dSettings.frame_size_limit = (sizeof(size_t) < 8) ? (8192 * 8192) : AVIF_MAX_IMAGE_SIZE;
// Ensure that we only get the "highest spatial layer" as a single frame
// for each input sample, instead of getting each spatial layer as its own