From 3b3dc211fed40e7e4f627dffd6a4e221eb481880 Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 20 Oct 2026 20:53:05 -0300 Subject: [PATCH] avformat/mov: don't error out on invalid gain map payloads Unless it's requested by the user's compliant level. Allows demuxing some seemingly non spec-compliant files in the wild again after the recent Gain Map support addition. Signed-off-by: James Almer --- libavformat/mov.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 870cb9703e..910df844dc 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -11683,9 +11683,12 @@ static int mov_parse_heif_layered_video_tmap(AVFormatContext *s, const HEIFGroup err = av_gain_map_params_from_iso21496(gain, payload, tmap->item->extent_length - 1); av_freep(&payload); - if (err < 0) + if (err < 0) { + av_log(s, AV_LOG_ERROR, "Invalid ISO 21496-1 gain map payload\n"); + ff_remove_stream_group(s, stg); + err = (s->error_recognition & (AV_EF_COMPLIANT|AV_EF_EXPLODE)) ? AVERROR_INVALIDDATA : 0; goto fail; - + } for (int j = 0; j < tmap->nb_items; j++) { HEIFItem *item = tmap->item_list[j]; AVPacketSideData *sd;