Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2020-09-05 18:46:42 +0300
committerMarton Balint <cus@passwd.hu>2020-09-13 18:51:57 +0300
commit535740167134ac6616344261157cf7e2a4ce8a9c (patch)
treecb8e826dd712aba4a454c7a76fa6f2ac59424f09 /libavutil/timecode.c
parentd0596e0bb0ea6536aa13090e0f920d8e532c975b (diff)
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@passwd.hu>
Diffstat (limited to 'libavutil/timecode.c')
-rw-r--r--libavutil/timecode.c5
1 files changed, 5 insertions, 0 deletions
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;