avfilter/avf_showwaves: Check history_nb_samples

Fixes: out of array access
Fixes: tickets/10756/poc18ffmpeg

Discovered by Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/7.0
Michael Niedermayer 1 year ago
parent 56c5930ec3
commit 08bd2cbfeb
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 2
      libavfilter/avf_showwaves.c

@ -440,6 +440,8 @@ static int config_output(AVFilterLink *outlink)
showwaves->history_nb_samples = av_rescale(showwaves->w * nb_channels * 2,
showwaves->n.num, showwaves->n.den);
if (showwaves->history_nb_samples <= 0)
return AVERROR(EINVAL);
showwaves->history = av_calloc(showwaves->history_nb_samples,
sizeof(*showwaves->history));
if (!showwaves->history)

Loading…
Cancel
Save