aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-04-13 10:20:59 +0200
committerPaul B Mahol <onemda@gmail.com>2022-04-13 10:25:08 +0200
commit9a22c6508a413f62080801c2d08b24d064719fcb (patch)
tree2d86ad254200cb5d9cc200e63768d3c48a2744cd
parentb74f212b7a9eb6f66584c296375407c410a0d5d1 (diff)
downloadffmpeg-9a22c6508a413f62080801c2d08b24d064719fcb.tar.gz
avfilter/vf_deblock: fix posible overreads
-rw-r--r--libavfilter/vf_deblock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavfilter/vf_deblock.c b/libavfilter/vf_deblock.c
index b7c6a03d4a..770fce0eab 100644
--- a/libavfilter/vf_deblock.c
+++ b/libavfilter/vf_deblock.c
@@ -337,7 +337,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
s->deblockv(dst + x * s->bpc, out->linesize[plane],
FFMIN(block, height), s->ath, s->bth, s->gth, s->dth, s->max);
- for (y = block; y < height; y += block) {
+ for (y = block; y < height - block; y += block) {
dst += out->linesize[plane] * block;
s->deblockh(dst, out->linesize[plane],
@@ -353,6 +353,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
s->ath, s->bth, s->gth, s->dth, s->max);
}
}
+
+ dst += out->linesize[plane] * block;
+ for (x = block; x < width; x += block)
+ s->deblockv(dst + x * s->bpc, out->linesize[plane],
+ FFMIN(block, height - y), s->ath, s->bth, s->gth, s->dth, s->max);
+
}
if (in != out)