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 745680c2d2 avformat/mov: bound iloc/iinf item counts by the box size
745680c2d2 is described below

commit 745680c2d2fce7a87b4fe861d2b1fc2534349ae7
Author:     Hawthorn <[email protected]>
AuthorDate: Mon Aug 17 20:09:49 2026 +0530
Commit:     Hawthorn <[email protected]>
CommitDate: Mon Aug 17 14:41:27 2026 +0000

    avformat/mov: bound iloc/iinf item counts by the box size
    
    mov_read_iloc() and mov_read_iinf() read a 16- or 32-bit item/entry
    count from the file and pass it straight to av_realloc_array() with no
    limit, so a small box can drive a multi-gigabyte allocation before the
    read loop hits EOF. Reject counts larger than the remaining box size,
    matching the existing sgpd bound.
    
    Signed-off-by: Hawthorn <[email protected]>
---
 libavformat/mov.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5a66d572ee..fcec8d1633 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9435,6 +9435,9 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     }
     item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
 
+    if (item_count > atom.size)
+        return AVERROR_INVALIDDATA;
+
     heif_item = av_realloc_array(c->heif_item, FFMAX(item_count, 
c->nb_heif_item), sizeof(*c->heif_item));
     if (!heif_item)
         return AVERROR(ENOMEM);
@@ -9593,6 +9596,9 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     avio_rb24(pb);  // flags.
     entry_count = version ? avio_rb32(pb) : avio_rb16(pb);
 
+    if (entry_count > atom.size)
+        return AVERROR_INVALIDDATA;
+
     heif_item = av_realloc_array(c->heif_item, FFMAX(entry_count, 
c->nb_heif_item), sizeof(*c->heif_item));
     if (!heif_item)
         return AVERROR(ENOMEM);

-- 
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