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

Git pushed a commit to branch master
in repository ffmpeg.

commit 67926e6667f84d98cc8d7cbb3eb77bc760155db4
Author:     He Huang <[email protected]>
AuthorDate: Sat Sep 5 02:47:31 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Wed Sep 16 20:48:11 2026 +0000

    avformat/mov: bound the keys atom entry count by the atom size
    
    mov_read_keys() allocated (count + 1) pointers from the 32 bit entry
    count of the keys atom before reading a single key record, so a 56 byte
    file declaring 16777216 keys made ffprobe allocate and zero 128 MiB.
    Every key record takes at least 8 bytes, so a count above atom.size / 8
    cannot be satisfied and is rejected before the allocation.
    
    Fixes: unbounded allocation
    Fixes: poc-keys-count-16777216.mp4
    Fixes: hKO4f7GYoUd0
    Found-by: He Huang, discovery assisted by NexusSan
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 59361cd30d..75b708b840 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5728,7 +5728,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     avio_skip(pb, 4);
     count = avio_rb32(pb);
     atom.size -= 8;
-    if (count >= UINT_MAX / sizeof(*c->meta_keys)) {
+    if (count > atom.size / 8 || count >= UINT_MAX / sizeof(*c->meta_keys)) {
         av_log(c->fc, AV_LOG_ERROR,
                "The 'keys' atom with the invalid key count: %"PRIu32"\n", 
count);
         return AVERROR_INVALIDDATA;

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