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

Clément Bœsch ubitux at gmail.com
Sun Oct 14 02:22:26 CEST 2012


On Sat, Oct 13, 2012 at 06:37:36PM +0200, Michael Niedermayer wrote:
> 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
> 

Indeed, added a nb_sad for div

> otherwise LGTM
>  

and pushed, thanks

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121014/280370b9/attachment.asc>


More information about the ffmpeg-devel mailing list