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

Michael Niedermayer michaelni at gmx.at
Sat Oct 13 18:37:36 CEST 2012


On Sat, Oct 13, 2012 at 06:31:43PM +0200, Clément Bœsch wrote:
> 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,

missing update to the sad rescaling as this can check fewer pixels
than w/h

otherwise LGTM
 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121013/6b9ff6d9/attachment.asc>


More information about the ffmpeg-devel mailing list