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

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

commit cb8a5ca8ab36884064ac4de5175ae82c93edfcb2
Author:     Dale Curtis <[email protected]>
AuthorDate: Thu Apr 30 21:01:33 2026 +0000
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Thu Jun 18 20:30:51 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 13190819f7..96f926261a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -10914,6 +10914,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;
 
@@ -10956,6 +10957,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