[FFmpeg-cvslog] avutil/timecode: fix sscanf format string with garbage at the end

Limin Wang git at videolan.org
Sat Jan 16 03:30:15 EET 2021


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Sat Dec  5 09:39:38 2020 +0800| [6696a07ac62bfec49dd488510a719367918b9f7a] | committer: Limin Wang

avutil/timecode: fix sscanf format string with garbage at the end

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6696a07ac62bfec49dd488510a719367918b9f7a
---

 libavutil/timecode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index c1fa445d31..5106f642b9 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -252,7 +252,7 @@ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *st
     char c;
     int hh, mm, ss, ff, flags;
 
-    if (sscanf(str, "%d:%d:%d%c%d", &hh, &mm, &ss, &c, &ff) != 5) {
+    if (sscanf(str, "%02u:%02u:%02u%c%02u", &hh, &mm, &ss, &c, &ff) != 5) {
         av_log(log_ctx, AV_LOG_ERROR, "Unable to parse timecode, "
                                       "syntax: hh:mm:ss[:;.]ff\n");
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list