This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/8.1
in repository ffmpeg.

commit 56e8d17d9bcd0676f4171ac203d09ecc8a1901b5
Author:     Dale Curtis <[email protected]>
AuthorDate: Thu Apr 30 21:01:33 2026 +0000
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Jun 14 04:40:49 2026 +0200

    avformat/mov: Fix negative index given to can_seek_to_key_sample()
    
    The potentially negative return value of av_index_search_timestamp()
    wasn't being handled before passing it to can_seek_to_key_sample().
    
    Found by Wongi Lee (@_qwerty_po) of Theori with Xint Code,
    Jungwoo Lee (@physicube).
    
    Signed-off-by: Dale Curtis <[email protected]>
    (cherry picked from commit 256d93413f260e1524c2ab994dc72c4edaa0d04c)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/mov.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d99977de1f..468715719f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -11584,6 +11584,7 @@ static int can_seek_to_key_sample(AVStream *st, int 
sample, int64_t requested_pt
     if (sample >= sc->sample_offsets_count)
         return 1;
 
+    av_assert0(sample >= 0);
     key_sample_dts = sti->index_entries[sample].timestamp;
     key_sample_pts = key_sample_dts + sc->sample_offsets[sample] + 
sc->dts_shift;
 
@@ -11627,6 +11628,8 @@ static int mov_seek_stream(AVFormatContext *s, AVStream 
*st, int64_t timestamp,
 
         next_ts = timestamp - FFMAX(sc->min_sample_duration, 1);
         requested_sample = av_index_search_timestamp(st, next_ts, flags);
+        if (requested_sample < 0)
+            return AVERROR_INVALIDDATA;
 
         // If we've reached a different sample trying to find a good pts to
         // seek to, give up searching because we'll end up seeking back to

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to