[FFmpeg-cvslog] avutil/mathematics: Fix overflow with NaN in av_add_stable()

Dale Curtis git at videolan.org
Sat Jun 6 01:51:21 EEST 2020


ffmpeg | branch: master | Dale Curtis <dalecurtis at chromium.org> | Thu May 14 14:47:49 2020 -0700| [d9aa1ef2c2dfbadcfe3783cee97e9c59dbfe7fb1] | committer: Michael Niedermayer

avutil/mathematics: Fix overflow with NaN in av_add_stable()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9aa1ef2c2dfbadcfe3783cee97e9c59dbfe7fb1
---

 libavutil/mathematics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 0485db7222..16c6e4db03 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -207,7 +207,7 @@ int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t i
         int64_t old = av_rescale_q(ts, ts_tb, inc_tb);
         int64_t old_ts = av_rescale_q(old, inc_tb, ts_tb);
 
-        if (old == INT64_MAX)
+        if (old == INT64_MAX || old == AV_NOPTS_VALUE || old_ts == AV_NOPTS_VALUE)
             return ts;
 
         return av_rescale_q(old + 1, inc_tb, ts_tb) + (ts - old_ts);



More information about the ffmpeg-cvslog mailing list