Commit 3b3dc211fe for ffmpeg
commit 3b3dc211fed40e7e4f627dffd6a4e221eb481880
Author: James Almer <jamrial@gmail.com>
Date: Tue Oct 20 20:53:05 2026 -0300
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 <jamrial@gmail.com>
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;