diff mbox series

[FFmpeg-devel,1/4] avfilter/avf_showwaves: Check history_nb_samples

Message ID 20231230024905.17121-1-michael@niedermayer.cc
State Accepted
Commit 08bd2cbfeb34717d60ec62bcbaeb7996206df906
Headers show
Series [FFmpeg-devel,1/4] avfilter/avf_showwaves: Check history_nb_samples | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Dec. 30, 2023, 2:49 a.m. UTC
Fixes: out of array access
Fixes: tickets/10756/poc18ffmpeg

Discovered by Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/avf_showwaves.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Dec. 30, 2023, 8:46 p.m. UTC | #1
On Sat, Dec 30, 2023 at 03:49:02AM +0100, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: tickets/10756/poc18ffmpeg
> 
> Discovered by Zeng Yunxiang
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/avf_showwaves.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply patchset, so the fixes can go in 6.1.1

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 329753c8c86..e19b93a2077 100644
--- a/libavfilter/avf_showwaves.c
+++ b/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)