[FFmpeg-cvslog] avformat/mov: Don't add attached pic if one is already present

Andreas Rheinhardt git at videolan.org
Tue Apr 2 16:06:54 EEST 2024


ffmpeg | branch: release/7.0 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Apr  2 04:13:44 2024 +0200| [efa0670048ddc8450c8fca380f65d7accd7f26a8] | committer: Andreas Rheinhardt

avformat/mov: Don't add attached pic if one is already present

Fixes: memleak
Fixes: 67714/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5671570999476224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit 9d219ff149738a9a6e3ba8f075c032cc1a3554f7)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efa0670048ddc8450c8fca380f65d7accd7f26a8
---

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index be4291c0da..50fbcd1f9b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8820,7 +8820,7 @@ static void mov_read_chapters(AVFormatContext *s)
 
         if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
             st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS;
-            if (sti->nb_index_entries) {
+            if (!st->attached_pic.data && sti->nb_index_entries) {
                 // Retrieve the first frame, if possible
                 AVIndexEntry *sample = &sti->index_entries[0];
                 if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {



More information about the ffmpeg-cvslog mailing list