[FFmpeg-cvslog] avutil/timecode: do not trash bits on invalid av_timecode_get_smpte arguments

Marton Balint git at videolan.org
Sun Sep 13 19:50:30 EEST 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Sep  5 17:46:42 2020 +0200| [535740167134ac6616344261157cf7e2a4ce8a9c] | committer: Marton Balint

avutil/timecode: do not trash bits on invalid av_timecode_get_smpte arguments

The function has no way to return error, so let's clip or calculate modulo.

Signed-off-by: Marton Balint <cus at passwd.hu>

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

 libavutil/timecode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index c0956adadb..806638ddfc 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -84,6 +84,11 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss
         ff /= 2;
     }
 
+    hh = hh % 24;
+    mm = av_clip(mm, 0, 59);
+    ss = av_clip(ss, 0, 59);
+    ff = ff % 40;
+
     tc |= drop << 30;
     tc |= (ff / 10) << 28;
     tc |= (ff % 10) << 24;



More information about the ffmpeg-cvslog mailing list