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

Git pushed a commit to branch master
in repository ffmpeg.

commit 0ea090e09f1e0d0407e961284ee9de8c31b8c1b1
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue May 19 16:47:46 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Fri Jun 5 01:14:02 2026 +0000

    avformat/gxfenc: Check timecode and propagate error
    
    Fixes: ./ffmpeg   -f lavfi -i testsrc=duration=0.1:size=720x480:rate=30   
-c:v mpeg2video -frames:v 1   -metadata timecode="999999999:00:00:00"   -f gxf 
output.gxf
    
    Found-by: jiale yao
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/gxfenc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 43ffa9d455..023c20d4e5 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -669,9 +669,12 @@ static int gxf_init_timecode(AVFormatContext *s, 
GXFTimecode *tc, const char *tc
     if (sscanf(tcstr, "%d:%d:%d%c%d", &tc->hh, &tc->mm, &tc->ss, &c, &tc->ff) 
!= 5) {
         av_log(s, AV_LOG_ERROR, "unable to parse timecode, "
                                 "syntax: hh:mm:ss[:;.]ff\n");
-        return -1;
+        return AVERROR(EINVAL);
     }
 
+    if (tc->hh > 31U  || tc->mm > 255U || tc->ss > 255U || tc->ff > (255U >> 
(fields == 2)))
+        return AVERROR(EINVAL);
+
     tc->color = 0;
     tc->drop = c != ':';
 
@@ -803,8 +806,11 @@ static int gxf_write_header(AVFormatContext *s)
         sc->order = s->nb_streams - st->index;
     }
 
-    if (tcr && vsc)
-        gxf_init_timecode(s, &gxf->tc, tcr->value, vsc->fields);
+    if (tcr && vsc) {
+        ret = gxf_init_timecode(s, &gxf->tc, tcr->value, vsc->fields);
+        if (ret < 0)
+            return ret;
+    }
 
     gxf_init_timecode_track(&gxf->timecode_track, vsc);
     gxf->flags |= 0x200000; // time code track is non-drop frame

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to