diff --git a/libavfilter/avf_showcwt.c b/libavfilter/avf_showcwt.c index 6574839823..e995208e00 100644 --- a/libavfilter/avf_showcwt.c +++ b/libavfilter/avf_showcwt.c @@ -1150,7 +1150,7 @@ static int output_frame(AVFilterContext *ctx) case DIRECTION_RL: for (int p = 0; p < nb_planes; p++) { ptrdiff_t linesize = s->outpicref->linesize[p]; - const int size = s->w - s->pos; + const int size = FFMIN(s->pos + 1, s->sono_size); const int fill = p > 0 && p < 3 ? 128 : 0; for (int y = 0; y < s->h; y++) {