Commit 4b1149c8eb for ffmpeg
commit 4b1149c8eb219bfbbbfd8e0cf960a208ffcf3447
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 26 01:12:01 2026 +0100
avformat/mov: fix leak of the gain map parameters when the tmap payload allocation fails
The payload size is the item's extent length from the file, so the
allocation can fail for a crafted file.
Leak Replicated through UnModified FFmpeg with LSAN
Found by a grok bot based audit of the code.
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 83bf9fa8d4..786994699e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -11662,7 +11662,7 @@ static int mov_parse_heif_layered_video_tmap(AVFormatContext *s, const HEIFGroup
payload = av_malloc(tmap->item->extent_length);
if (!payload) {
- return AVERROR(ENOMEM);
+ err = AVERROR(ENOMEM);
goto fail;
}