Ticket #117: scale_segv.diff

File scale_segv.diff, 1014 bytes (added by reimar, 15 years ago)

possible fix.

  • 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
     
    296296//      dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK));
    297297   
    298298  if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){
     299    int h;
    299300 
    300301    // hope we'll get DR buffer:
    301302    dmpi=vf_get_image(vf->next,vf->priv->fmt,
    302303        MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
    303304        vf->priv->w, vf->priv->h);
    304305   
    305       scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
     306   h = (dmpi->h < mpi->h)? dmpi->h : mpi->h;
     307   scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,h,dmpi->planes,dmpi->stride, vf->priv->interlaced);
    306308  }
    307309
    308310    if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){