[FFmpeg-cvslog] avfilter/avf_showcqt: fix crash when using vflip filter

Paul B Mahol git at videolan.org
Fri Nov 25 20:46:41 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Nov 25 19:37:44 2022 +0100| [4c1a79eb803edd12e353278993fe15755f1612fa] | committer: Paul B Mahol

avfilter/avf_showcqt: fix crash when using vflip filter

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

 libavfilter/avf_showcqt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 93229a14eb..76086477e9 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -1031,16 +1031,17 @@ static void draw_sono(AVFrame *out, AVFrame *sono, int off, int idx)
     int nb_planes = (fmt == AV_PIX_FMT_RGB24) ? 1 : 3;
     int offh = (fmt == AV_PIX_FMT_YUV420P) ? off / 2 : off;
     int inc = (fmt == AV_PIX_FMT_YUV420P) ? 2 : 1;
-    int ls, i, y, yh;
+    ptrdiff_t ls;
+    int i, y, yh;
 
-    ls = FFMIN(out->linesize[0], sono->linesize[0]);
+    ls = FFABS(FFMIN(out->linesize[0], sono->linesize[0]));
     for (y = 0; y < h; y++) {
         memcpy(out->data[0] + (off + y) * out->linesize[0],
                sono->data[0] + (idx + y) % h * sono->linesize[0], ls);
     }
 
     for (i = 1; i < nb_planes; i++) {
-        ls = FFMIN(out->linesize[i], sono->linesize[i]);
+        ls = FFABS(FFMIN(out->linesize[i], sono->linesize[i]));
         for (y = 0; y < h; y += inc) {
             yh = (fmt == AV_PIX_FMT_YUV420P) ? y / 2 : y;
             memcpy(out->data[i] + (offh + yh) * out->linesize[i],



More information about the ffmpeg-cvslog mailing list