diff mbox

[FFmpeg-devel] avfilter/fade: don't allow nb_frames == 0

Message ID 58d6ba8b-8414-ed9d-7c19-b10ad1ec1949@gyani.pro
State Accepted
Commit 43891ea8ab286a08e731ebac78123c4f1b1d35ca
Headers show

Commit Message

Gyan Doshi July 29, 2019, 5:29 a.m. UTC
Fixes crash when user inputs a sub-unit fractional number for nb_frames.

Gyan
From b3e463c6514eabb1081a22e32dce33d62f5278ce Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Mon, 29 Jul 2019 10:53:12 +0530
Subject: [PATCH] avfilter/fade: don't allow nb_frames == 0

In filter init, there's a division by nb_frames but value isn't checked.
---
 libavfilter/vf_fade.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul B Mahol July 29, 2019, 6:46 a.m. UTC | #1
LGTM

On Mon, Jul 29, 2019 at 7:30 AM Gyan <ffmpeg@gyani.pro> wrote:

>
> Fixes crash when user inputs a sub-unit fractional number for nb_frames.
>
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Gyan Doshi July 29, 2019, 7:19 a.m. UTC | #2
On 29-07-2019 12:16 PM, Paul B Mahol wrote:
> LGTM
Pushed as 43891ea8ab286a08e731ebac78123c4f1b1d35ca

Thanks,
Gyan
diff mbox

Patch

diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 17eca109b6..bec765a09e 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -381,9 +381,9 @@  static const AVOption fade_options[] = {
     { "s",           "Number of the first frame to which to apply the effect.",
                                                     OFFSET(start_frame), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
     { "nb_frames",   "Number of frames to which the effect should be applied.",
-                                                    OFFSET(nb_frames),   AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
+                                                    OFFSET(nb_frames),   AV_OPT_TYPE_INT, { .i64 = 25 }, 1, INT_MAX, FLAGS },
     { "n",           "Number of frames to which the effect should be applied.",
-                                                    OFFSET(nb_frames),   AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
+                                                    OFFSET(nb_frames),   AV_OPT_TYPE_INT, { .i64 = 25 }, 1, INT_MAX, FLAGS },
     { "alpha",       "fade alpha if it is available on the input", OFFSET(alpha),       AV_OPT_TYPE_BOOL, {.i64 = 0    }, 0,       1, FLAGS },
     { "start_time",  "Number of seconds of the beginning of the effect.",
                                                     OFFSET(start_time),  AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS },