diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-04-13 15:45:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-13 18:07:08 +0200 |
commit | 423089e964410adbf13af3de42e3c9dd5a1babd6 (patch) | |
tree | b569c9311cd445f1549d9abf767937d37d3dbdd8 | |
parent | c8b364449424f09397a3be46b8215ed92284e393 (diff) | |
download | ffmpeg-423089e964410adbf13af3de42e3c9dd5a1babd6.tar.gz |
lavf/mxfdec: validate month/day before date formatting
Some implementations of strftime do not like invalid values for
month/day, so ensure it doesn't happen.
Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mxfdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 4ceaaee844..33e1eb4b85 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1668,6 +1668,10 @@ static int mxf_timestamp_to_str(uint64_t timestamp, char **str) time.tm_min = (timestamp >> 16 & 0xFF); time.tm_sec = (timestamp >> 8 & 0xFF); + /* ensure month/day are valid */ + time.tm_mon = FFMAX(time.tm_mon, 0); + time.tm_mday = FFMAX(time.tm_mday, 1); + *str = av_mallocz(32); if (!*str) return AVERROR(ENOMEM); |