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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 507f6dd6f7 avformat/bink: do not dereference the index in read_seek() 
when it is empty
507f6dd6f7 is described below

commit 507f6dd6f775736a12a47bb87900954b0dffc2c7
Author:     Richard Desmarais <[email protected]>
AuthorDate: Thu Nov 12 10:05:56 2026 -0500
Commit:     Peter Ross <[email protected]>
CommitDate: Fri Nov 13 16:59:19 2026 +0000

    avformat/bink: do not dereference the index in read_seek() when it is empty
    
    read_header() adds one index entry per frame, bounded by the frame count
    from the header, and guards the zero-frames case before touching
    index_entries[0] (bink.c:227). read_seek() has no such guard and
    dereferences index_entries[0] unconditionally, so any seek into a Bink
    file that declares zero frames (which opens fine) crashes with SIGSEGV:
    
        ret = avio_seek(s->pb, vsti->index_entries[0].pos + bink->smush_size, 
SEEK_SET);
    
    Reproduce with a 48-byte sample (BIK header, zero frames):
        ffmpeg -ss 1 -f bink -i poc.bik -f null -
    before: "SEGV on unknown address 0x000000000000" (ASAN), the demuxer
    keeps a NULL index when nb_frames == 0;
    after: "no index entries", AVERROR(EINVAL).
    
    Signed-off-by: Richard Desmarais <[email protected]>
---
 libavformat/bink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 6becc59031..ce03adcf87 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -313,6 +313,10 @@ static int read_seek(AVFormatContext *s, int stream_index, 
int64_t timestamp, in
     if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL))
         return -1;
 
+    /* read_header() builds no index when the frame count is zero */
+    if (!vsti->index_entries)
+        return AVERROR(EINVAL);
+
     /* seek to the first frame */
     ret = avio_seek(s->pb, vsti->index_entries[0].pos + bink->smush_size, 
SEEK_SET);
     if (ret < 0)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to