summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showcqt.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-11-25 19:37:44 +0100
committerPaul B Mahol <onemda@gmail.com>2022-11-25 19:40:11 +0100
commit4c1a79eb803edd12e353278993fe15755f1612fa (patch)
treeda24c3c9bdb38670483924e67db806a87d09683a /libavfilter/avf_showcqt.c
parent9d2b5762d3a29e4b2758d3ca1a7d70e362c6febf (diff)
avfilter/avf_showcqt: fix crash when using vflip filter
Diffstat (limited to 'libavfilter/avf_showcqt.c')
-rw-r--r--libavfilter/avf_showcqt.c7
1 files 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],