On Fri, Aug 11, 2017 at 09:35:32PM +0200, Luca Barbato wrote:
> On 11/08/2017 20:46, Diego Biurrun wrote:
> > From: Michael Niedermayer <mich...@niedermayer.cc>
> > 
> > Fixes out of array access
> > Fixes: 1399/clusterfuzz-testcase-minimized-4866094172995584
> > Bug-Id: CVE-2017-9991
> > CC: libav-sta...@libav.org
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> > (cherry picked from commit 441026fcb13ac23aa10edc312bdacb6445a0ad06)
> > Signed-off-by: Diego Biurrun <di...@biurrun.de>
> > ---
> >  libavcodec/xwddec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
> > index cae6287987..22b6e52d5d 100644
> > --- a/libavcodec/xwddec.c
> > +++ b/libavcodec/xwddec.c
> > @@ -157,9 +157,9 @@ static int xwd_decode_frame(AVCodecContext *avctx, void 
> > *data,
> >      case XWD_GRAY_SCALE:
> >          if (bpp != 1 && bpp != 8)
> >              return AVERROR_INVALIDDATA;
> > -        if (pixdepth == 1) {
> > +        if (bpp == 1 && pixdepth == 1) {
> >              avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
> > -        } else if (pixdepth == 8) {
> > +        } else if (bpp == 8 && pixdepth == 8) {
> >              avctx->pix_fmt = AV_PIX_FMT_GRAY8;
> >          }
> >          break;
> > 
> 
> if the condition bpp != pixdepth is not valid for grayscale maybe would
> be better to error out with something like
> 
>    if (bpp != 1 && bpp != 8 && bpp != pixdepth)

You want || for the third condition there, sending an updated patch now.

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to