[Mplayer-cvslog] CVS: main/libmpcodecs vd_ffmpeg.c,1.44,1.45

Michael Niedermayer michael at mplayerhq.hu
Wed Aug 21 21:08:41 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv5662

Modified Files:
	vd_ffmpeg.c 
Log Message:
asserts to check buffer size and non overlapingness


Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- vd_ffmpeg.c	14 Aug 2002 21:43:49 -0000	1.44
+++ vd_ffmpeg.c	21 Aug 2002 19:08:24 -0000	1.45
@@ -351,6 +351,21 @@
     if(avctx->dr_uvstride && avctx->dr_uvstride !=mpi->stride[1]){
         mp_msg(MSGT_DECVIDEO,MSGL_ERR, "Error: uvstride changed\n");
     }
+    
+    assert(mpi->width  >= ((width +align)&(~align)));   
+    assert(mpi->height >= ((height+align)&(~align)));
+    assert(mpi->stride[0] >= mpi->width);
+    if(mpi->imgfmt==IMGFMT_I420 || mpi->imgfmt==IMGFMT_YV12 || mpi->imgfmt==IMGFMT_IYUV){
+        const int y_size= mpi->stride[0] * mpi->height;
+        const int c_size= mpi->stride[1] * mpi->chroma_height;
+        
+        assert(mpi->planes[0] > mpi->planes[1] || mpi->planes[0] + y_size <= mpi->planes[1]);
+        assert(mpi->planes[0] > mpi->planes[2] || mpi->planes[0] + y_size <= mpi->planes[2]);
+        assert(mpi->planes[1] > mpi->planes[0] || mpi->planes[1] + c_size <= mpi->planes[0]);
+        assert(mpi->planes[1] > mpi->planes[2] || mpi->planes[1] + c_size <= mpi->planes[2]);
+        assert(mpi->planes[2] > mpi->planes[0] || mpi->planes[2] + c_size <= mpi->planes[0]);
+        assert(mpi->planes[2] > mpi->planes[1] || mpi->planes[2] + c_size <= mpi->planes[1]);
+    }
 
     avctx->dr_stride   = mpi->stride[0];
     avctx->dr_uvstride = mpi->stride[1];




More information about the MPlayer-cvslog mailing list