changeset 6743:5c6cc735c946

check if the available buffers are big enough in get_image
author michael
date Wed, 17 Jul 2002 00:54:31 +0000
parents 93bce3460e2a
children a7c9c075abb6
files libvo/vo_xv.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Tue Jul 16 23:42:44 2002 +0000
+++ b/libvo/vo_xv.c	Wed Jul 17 00:54:31 2002 +0000
@@ -746,6 +746,9 @@
     if(mpi->type==MP_IMGTYPE_IPB && num_buffers<3 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough
     if(mpi->type==MP_IMGTYPE_IP  && num_buffers<2 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough
     if(mpi->imgfmt!=image_format || mpi->imgfmt==IMGFMT_BGR24) return VO_FALSE; // needs conversion :(
+    if(  xvimage[current_buf]->pitches[0]*mpi->height 
+       > xvimage[current_buf]->offsets[1] - xvimage[current_buf]->offsets[0]) return VO_FALSE; //buffer to small
+    if(  xvimage[current_buf]->pitches[0] < mpi->width /*FIXME non yv12*/) return VO_FALSE; //buffer to small
 //    if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
     if( (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) ||
 	(mpi->width*(mpi->bpp/8)==xvimage[current_buf]->pitches[0]) ){