aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2020-05-14 14:47:49 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2020-06-06 00:25:00 +0200
commitd9aa1ef2c2dfbadcfe3783cee97e9c59dbfe7fb1 (patch)
treef4f188be9289e714386e5980cb972a643b9dfe31
parent63ce7c71bc1b1b6c141df5daae0f8fed52194b72 (diff)
downloadffmpeg-d9aa1ef2c2dfbadcfe3783cee97e9c59dbfe7fb1.tar.gz
avutil/mathematics: Fix overflow with NaN in av_add_stable()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavutil/mathematics.c2
1 files changed, 1 insertions, 1 deletions
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);