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

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

commit 3224dd4e8f1ce4f244fc7b5aecacb0feb9c07a56
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Sep 20 12:44:33 2026 +0000
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Thu Nov 26 22:32:57 2026 +0100

    avformat/mov: allow explicit zero sample sizes in trun
    
    03d81a044ad587ea83567f75dc36bc3d64278199 rejected every zero-sized
    sample to avoid pathological runs of empty samples. This also prevents
    opening fragmented recordings with occasional explicit zero sizes.
    
    Allow explicit zero sample sizes, whose count is bounded by the trun
    payload checks. Continue rejecting nonempty runs that inherit a zero
    default size, but do so before allocating or updating the sample index.
    Keep empty samples in the index to preserve sample numbering and timing.
    
    Add a generated FATE test with an empty sample at the end of one fragment
    followed by another fragment. No external sample is needed.
    
    Fixes #23807.
    
    Assisted-by: Fairy
    (cherry picked from commit e9dc8fd4d6c4f46a02fe9d739141efb32596f7fe)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/mov.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 660f4aeae2..662e8bb56d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6033,6 +6033,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     entries = avio_rb32(pb);
     av_log(c->fc, AV_LOG_TRACE, "flags 0x%x entries %u\n", flags, entries);
 
+    /* Explicit zero sizes are bounded by the trun payload. Reject a zero
+     * default size before allocating or updating the sample index. */
+    if (entries && !frag->size && !(flags & MOV_TRUN_SAMPLE_SIZE))
+        return AVERROR_INVALIDDATA;
+
     if ((uint64_t)entries+sc->tts_count >= UINT_MAX/sizeof(*sc->tts_data))
         return AVERROR_INVALIDDATA;
     if (flags & MOV_TRUN_DATA_OFFSET)        data_offset        = 
avio_rb32(pb);
@@ -6236,8 +6241,6 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
         distance++;
         if (av_sat_add64(dts, sample_duration) != dts + 
(uint64_t)sample_duration)
             return AVERROR_INVALIDDATA;
-        if (!sample_size)
-            return AVERROR_INVALIDDATA;
         dts += sample_duration;
         offset += sample_size;
         sc->data_size += sample_size;

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