[FFmpeg-devel] [PATCH 2/3] avformat/hlsplaylist: add return value check of strftime
Steven Liu
lq at chinaffmpeg.org
Sat Dec 2 04:43:50 EET 2017
fix CID: 1424884
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
libavformat/hlsplaylist.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
index 96a8afbe1d..3349eb7ee3 100644
--- a/libavformat/hlsplaylist.c
+++ b/libavformat/hlsplaylist.c
@@ -109,7 +109,10 @@ int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
tt = (int64_t)*prog_date_time;
milli = av_clip(lrint(1000*(*prog_date_time - tt)), 0, 999);
tm = localtime_r(&tt, &tmpbuf);
- strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm);
+ if (!strftime(buf0, sizeof(buf0), "%Y-%m-%dT%H:%M:%S", tm)) {
+ av_log(NULL, AV_LOG_DEBUG, "strftime error in ff_hls_write_file_entry\n");
+ return AVERROR_UNKNOWN;
+ }
if (!strftime(buf1, sizeof(buf1), "%z", tm) || buf1[1]<'0' ||buf1[1]>'2') {
int tz_min, dst = tm->tm_isdst;
tm = gmtime_r(&tt, &tmpbuf);
--
2.11.0 (Apple Git-81)
More information about the ffmpeg-devel
mailing list