# HG changeset patch # User reimar # Date 1234897187 0 # Node ID 4cc1fbdaad5f9c1c9f7a831b28d6b0a0a169ba7c # Parent 88bb92d3c5b48d8b938048469af2936245eee0c9 Print an error and return NULL in vf_get_image if we try to allocate a format with bpp == 0, since this can not work. This way at least we crash earlier and print an error message. diff -r 88bb92d3c5b4 -r 4cc1fbdaad5f libmpcodecs/vf.c --- a/libmpcodecs/vf.c Tue Feb 17 16:40:50 2009 +0000 +++ b/libmpcodecs/vf.c Tue Feb 17 18:59:47 2009 +0000 @@ -320,7 +320,6 @@ // keep buffer allocation status & color flags only: // mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; - mpi->flags |= MP_IMGFLAG_IN_USE; // accept restrictions & draw_slice flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; @@ -347,6 +346,11 @@ if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! + if (!mpi->bpp) { // no way we can allocate this + mp_msg(MSGT_DECVIDEO, MSGL_FATAL, + "vf_get_image: Tried to allocate a format that can not be allocated!\n"); + return NULL; + } // check if codec prefer aligned stride: if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ @@ -427,6 +431,7 @@ mpi->qscale = NULL; } + mpi->flags |= MP_IMGFLAG_IN_USE; // printf("\rVF_MPI: %p %p %p %d %d %d \n", // mpi->planes[0],mpi->planes[1],mpi->planes[2], // mpi->stride[0],mpi->stride[1],mpi->stride[2]);