Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/4] avfilter/af_surround: Check return value of av_tx_init()
Date: Fri, 11 Nov 2022 18:36:22 +0100
Message-ID: <GV1SPRMB0038320647D329CCA8C74EE38F009@GV1SPRMB0038.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB074465F4EB46CDB0AD5182FA8F3E9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Andreas Rheinhardt:
> Should fix Coverity issue #1516766.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavfilter/af_surround.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
> index 858fed609a..969325cf6b 100644
> --- a/libavfilter/af_surround.c
> +++ b/libavfilter/af_surround.c
> @@ -194,7 +194,7 @@ static int config_input(AVFilterLink *inlink)
>  {
>      AVFilterContext *ctx = inlink->dst;
>      AudioSurroundContext *s = ctx->priv;
> -    int ch;
> +    int ch, err;
>  
>      s->rdft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->rdft));
>      if (!s->rdft)
> @@ -204,9 +204,10 @@ static int config_input(AVFilterLink *inlink)
>      for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
>          float scale = 1.f;
>  
> -        av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT, 0, s->buf_size, &scale, 0);
> -        if (!s->rdft[ch])
> -            return AVERROR(ENOMEM);
> +        err = av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT,
> +                         0, s->buf_size, &scale, 0);
> +        if (err < 0)
> +            return err;
>      }
>      s->input_levels = av_malloc_array(s->nb_in_channels, sizeof(*s->input_levels));
>      if (!s->input_levels)
> @@ -263,7 +264,7 @@ static int config_output(AVFilterLink *outlink)
>  {
>      AVFilterContext *ctx = outlink->src;
>      AudioSurroundContext *s = ctx->priv;
> -    int ch;
> +    int ch, err;
>  
>      s->irdft = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->irdft));
>      if (!s->irdft)
> @@ -273,9 +274,10 @@ static int config_output(AVFilterLink *outlink)
>      for (ch = 0; ch < outlink->ch_layout.nb_channels; ch++) {
>          float iscale = 1.f;
>  
> -        av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT, 1, s->buf_size, &iscale, 0);
> -        if (!s->irdft[ch])
> -            return AVERROR(ENOMEM);
> +        err = av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT,
> +                         1, s->buf_size, &iscale, 0);
> +        if (err < 0)
> +            return err;
>      }
>      s->output_levels = av_malloc_array(s->nb_out_channels, sizeof(*s->output_levels));
>      if (!s->output_levels)

Will apply this patchset tomorrow unless there are objections.

- Andreas

_______________________________________________
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".

      parent reply	other threads:[~2022-11-11 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 16:34 Andreas Rheinhardt
2022-11-09 16:37 ` [FFmpeg-devel] [PATCH 2/4] avfilter/vf_fftfilt: " Andreas Rheinhardt
2022-11-09 16:37 ` [FFmpeg-devel] [PATCH 3/4] avfilter/af_afir: " Andreas Rheinhardt
2022-11-09 16:37 ` [FFmpeg-devel] [PATCH 4/4] avfilter/vf_fftdnoiz: " Andreas Rheinhardt
2022-11-11 17:36 ` Andreas Rheinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV1SPRMB0038320647D329CCA8C74EE38F009@GV1SPRMB0038.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git