Fixes: out of array access Fixes: tickets/10756/poc18ffmpeg Discovered by Zeng Yunxiang Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Unified · Split
| @@ -440,6 +440,8 @@ static int config_output(AVFilterLink *outlink) · 439 unmodified lines | |||
| 440 | 440 | ||
| 441 | showwaves->history_nb_samples = av_rescale(showwaves->w * nb_channels * 2, | 441 | showwaves->history_nb_samples = av_rescale(showwaves->w * nb_channels * 2, |
| 442 | showwaves->n.num, showwaves->n.den); | 442 | showwaves->n.num, showwaves->n.den); |
| 443 | if (showwaves->history_nb_samples <= 0) | ||
| 444 | return AVERROR(EINVAL); | ||
| 443 | showwaves->history = av_calloc(showwaves->history_nb_samples, | 445 | showwaves->history = av_calloc(showwaves->history_nb_samples, |
| 444 | sizeof(*showwaves->history)); | 446 | sizeof(*showwaves->history)); |
| 445 | if (!showwaves->history) | 447 | if (!showwaves->history) |