[FFmpeg-cvslog] avfilter/avf_showwaves: Check history_nb_samples

Michael Niedermayer git at videolan.org
Sat Dec 30 23:33:58 EET 2023


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec 30 02:39:58 2023 +0100| [ea276a511a3aa3d8fdab352e96f13ca1ffd7ae2b] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 08bd2cbfeb34717d60ec62bcbaeb7996206df906)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea276a511a3aa3d8fdab352e96f13ca1ffd7ae2b
---

 libavfilter/avf_showwaves.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 329753c8c8..e19b93a207 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)



More information about the ffmpeg-cvslog mailing list