[MPlayer-dev-eng] [PATCH] segfault in vf_scale

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Oct 17 23:47:50 CEST 2004


Hi,
especially in combination with -vf pp, vf_scale can segfault because the
mpis can have different height, especially when height is not divisible
by 16.
Attached patch should fix it. Please check, I don't completely
understand those mpi-thingies ;-)

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpcodecs/vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.55
diff -u -r1.55 vf_scale.c
--- libmpcodecs/vf_scale.c	18 Sep 2004 00:08:16 -0000	1.55
+++ libmpcodecs/vf_scale.c	17 Oct 2004 21:33:49 -0000
@@ -296,13 +296,15 @@
 //	dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
     
   if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
+    int h;
   
     // hope we'll get DR buffer:
     dmpi=vf_get_image(vf->next,vf->priv->fmt,
 	MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
 	vf->priv->w, vf->priv->h);
     
-      scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
+   h = (dmpi->h < mpi->h)? dmpi->h : mpi->h;
+   scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
   }
 
     if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){


More information about the MPlayer-dev-eng mailing list