Browse code

avfilter/af_silenceremove: fix possible crash if supplied duration is negative

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2017/11/28 00:32:54
Showing 1 changed files
... ...
@@ -186,8 +186,17 @@ static int config_input(AVFilterLink *inlink)
186 186
 
187 187
     s->start_duration = av_rescale(s->start_duration, inlink->sample_rate,
188 188
                                    AV_TIME_BASE);
189
+    if (s->start_duration < 0) {
190
+        av_log(ctx, AV_LOG_WARNING, "start duration must be non-negative\n");
191
+        s->start_duration = -s->start_duration;
192
+    }
193
+
189 194
     s->stop_duration  = av_rescale(s->stop_duration, inlink->sample_rate,
190 195
                                    AV_TIME_BASE);
196
+    if (s->stop_duration < 0) {
197
+        av_log(ctx, AV_LOG_WARNING, "stop duration must be non-negative\n");
198
+        s->stop_duration = -s->stop_duration;
199
+    }
191 200
 
192 201
     s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1),
193 202
                                        sizeof(*s->start_holdoff) *