From: Hendrik Leppkes <[email protected]>

The MSVCRT version of strftime calls the invalid parameter handler
if the struct values in struct tm are invalid. In case no invalid
parameter handler is set for the process, the process is aborted.

This fixes fate failures on MSVC builds since 570af382.
---
 libavformat/mxfdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 27f996f..1276391 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1669,6 +1669,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);
-- 
1.8.3.4 (Apple Git-47)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to