[FFmpeg-devel] [PATCH v1 3/3] avfilter/af_adelay: Check sscanf() return value

Michael Niedermayer michael at niedermayer.cc
Fri Mar 27 21:34:02 EET 2020


On Thu, Mar 26, 2020 at 07:04:24AM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavfilter/af_adelay.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
> index c9647771f2..7f498ba190 100644
> --- a/libavfilter/af_adelay.c
> +++ b/libavfilter/af_adelay.c
> @@ -155,7 +155,8 @@ static int config_input(AVFilterLink *inlink)
>          ret = av_sscanf(arg, "%d%c", &d->delay, &type);
>          if (ret != 2 || type != 'S') {
>              div = type == 's' ? 1.0 : 1000.0;
> -            av_sscanf(arg, "%f", &delay);
> +            if (av_sscanf(arg, "%f", &delay) != 1)
> +                return AVERROR(EINVAL);

If this case occurs is it clear to the user what is the problem ?
Maybe an error message should be added here

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200327/0960a9c1/attachment.sig>


More information about the ffmpeg-devel mailing list