summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-10 11:51:40 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-10 11:51:40 +0100
commit4c63beeefe9fcd42f12fe5545a63bb8114e8bea0 (patch)
tree48dd20543396041cdb16e2d74999db7fb0541bc3
parent53eb4e0799b7c09022eea2fb03d91ffde1f953dd (diff)
parent8cafeb8bca5d079041739dbd72ccec0ead138eaf (diff)
Merge commit '8cafeb8bca5d079041739dbd72ccec0ead138eaf'
* commit '8cafeb8bca5d079041739dbd72ccec0ead138eaf': mxfdec: Validate parameters to strftime Conflicts: libavformat/mxfdec.c See: 423089e964410adbf13af3de42e3c9dd5a1babd6 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mxfdec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 31d6d463ba..ad622f05b6 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1704,9 +1704,14 @@ 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);
+ /* msvcrt versions of strftime calls the invalid parameter handler
+ * (aborting the process if one isn't set) if the parameters are out
+ * of range. */
+ time.tm_mon = av_clip(time.tm_mon, 0, 11);
+ time.tm_mday = av_clip(time.tm_mday, 1, 31);
+ time.tm_hour = av_clip(time.tm_hour, 0, 23);
+ time.tm_min = av_clip(time.tm_min, 0, 59);
+ time.tm_sec = av_clip(time.tm_sec, 0, 59);
*str = av_mallocz(32);
if (!*str)