ffmpeg | branch: release/7.0 | Marton Balint <c...@passwd.hu> | Mon Jun 17 22:30:26 2024 +0200| [c75cabef94e0985d1aa3f8d5ea9f4f7b8795d5ab] | committer: Marton Balint
avutil/timestamp: avoid possible FPE when 0 is passed to av_ts_make_time_string2() Signed-off-by: Marton Balint <c...@passwd.hu> (cherry picked from commit 0d5e3f5a4034b6c9312b7c621e25aa4303a00b6f) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c75cabef94e0985d1aa3f8d5ea9f4f7b8795d5ab --- libavutil/timestamp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c index 2a3e3012a4..6c231a517d 100644 --- a/libavutil/timestamp.c +++ b/libavutil/timestamp.c @@ -24,7 +24,7 @@ char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); } else { double val = av_q2d(tb) * ts; - double log = floor(log10(fabs(val))); + double log = (fpclassify(val) == FP_ZERO ? -INFINITY : floor(log10(fabs(val)))); int precision = (isfinite(log) && log < 0) ? -log + 5 : 6; int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision, val); last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".