[FFmpeg-devel] Patch: fix ffplay segmentation fault

Reimar Döffinger Reimar.Doeffinger
Mon Mar 23 09:58:43 CET 2009


On Mon, Mar 23, 2009 at 03:30:09PM +0800, avcoder wrote:
> Dear:
> 
> It seems that the recent swscale development has broken ffplay
> 
> the following patch/hack will fix it
> 
> Index: swscale.c
> ===================================================================
> --- swscale.c	??? 29040?
> +++ swscale.c	??????
> @@ -2120,7 +2120,7 @@
>          if (!dst[plane]) continue;
>          // ignore palette for GRAY8
>          if (plane == 1 && !dst[2]) continue;
> -        if (!src[plane] || (plane == 1 && !src[2]))
> +        if (dst[plane] && (!src[plane] || (plane == 1 && !src[2])))
>              fillPlane(dst[plane], dstStride[plane], length, height,
> y, (plane==3) ? 255 : 128);
>          else
>          {

given the "if (!dst[plane]) continue;" above this can't be necessary.

> Index: ffplay.c
> ===================================================================
> --- ffplay.c	??? 18169?
> +++ ffplay.c	??????
> @@ -1242,6 +1242,7 @@
>          return -1;
> 
>      vp = &is->pictq[is->pictq_windex];
> +    memset(&pict,0,sizeof(AVPicture));
> 
>      /* alloc or resize hardware picture buffer */
>      if (!vp->bmp ||

The declaration and memset for pict should be moved into the if where it
is used.



More information about the ffmpeg-devel mailing list