# HG changeset patch # User reimar # Date 1353853092 0 # Node ID b18c145266622917bdc57c639928eb70eb84bcf2 # Parent 2b49f4c8c47f797b3efd6e491b73c7fb753da03b Fix incorrect mp_image allocations when the input format changes. Should fix crashes when decoding JPEG images with different subsampling. diff -r 2b49f4c8c47f -r b18c14526662 libmpcodecs/vf.c --- a/libmpcodecs/vf.c Sun Nov 25 14:17:23 2012 +0000 +++ b/libmpcodecs/vf.c Sun Nov 25 14:18:12 2012 +0000 @@ -358,15 +358,16 @@ mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) && (mp_imgflag & MP_IMGFLAG_RGB_PALETTE); - if(mpi->width!=w2 || mpi->height!=h || missing_palette){ + if(mpi->width!=w2 || mpi->height!=h || mpi->imgfmt != outfmt || missing_palette){ // printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - if(mpi->widthheightwidthheightimgfmt != outfmt || missing_palette){ // need to re-allocate buffer memory: av_freep(&mpi->planes[0]); if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) av_freep(&mpi->planes[1]); mpi->flags&=~MP_IMGFLAG_ALLOCATED; + mpi->bpp = 0; mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory in vf_%s :(\n", vf->info->name); }