[FFmpeg-devel] [PATCH 2/5] lavfi/select/scene: fix potential overread.

Clément Bœsch ubitux at gmail.com
Sat Oct 13 18:31:43 CEST 2012


Also make sure we use the actual width of the image and not the whole
linesize.
---
 libavfilter/vf_select.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c
index c600024..f308a90 100644
--- a/libavfilter/vf_select.c
+++ b/libavfilter/vf_select.c
@@ -211,8 +211,8 @@ static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref)
         uint8_t *p2 = prev_picref->data[0];
         const int linesize = picref->linesize[0];
 
-        for (y = 0; y < picref->video->h; y += 8)
-            for (x = 0; x < linesize; x += 8)
+        for (y = 0; y < picref->video->h - 8; y += 8)
+            for (x = 0; x < picref->video->w*3 - 8; x += 8)
                 sad += select->c.sad[1](select,
                                         p1 + y * linesize + x,
                                         p2 + y * linesize + x,
-- 
1.7.12.2



More information about the ffmpeg-devel mailing list