diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-11-27 16:32:54 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2019-01-25 00:53:39 +0100 |
commit | bdcbe9296a43580fb27f8a3eda65d9110a85edcf (patch) | |
tree | 2f41c5900e04e86036d8cf521e53aa39715172e0 | |
parent | 527e64d32c345e2da17ae8afc0f852c3cca28345 (diff) | |
download | ffmpeg-bdcbe9296a43580fb27f8a3eda65d9110a85edcf.tar.gz |
avfilter/af_silenceremove: fix possible crash if supplied duration is negative
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Fixes ticket #7697.
(cherry picked from commit 2d1594a8d6a754a426cb53184dccf9cf8c8a94b0)
-rw-r--r-- | libavfilter/af_silenceremove.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index f156d1883d..3d3651a76f 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -186,8 +186,17 @@ static int config_input(AVFilterLink *inlink) s->start_duration = av_rescale(s->start_duration, inlink->sample_rate, AV_TIME_BASE); + if (s->start_duration < 0) { + av_log(ctx, AV_LOG_WARNING, "start duration must be non-negative\n"); + s->start_duration = -s->start_duration; + } + s->stop_duration = av_rescale(s->stop_duration, inlink->sample_rate, AV_TIME_BASE); + if (s->stop_duration < 0) { + av_log(ctx, AV_LOG_WARNING, "stop duration must be non-negative\n"); + s->stop_duration = -s->stop_duration; + } s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1), sizeof(*s->start_holdoff) * |