mirror of
https://github.com/mpv-player/mpv
synced 2024-12-14 19:05:33 +00:00
asserts to check buffer size and non overlapingness
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7052 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
89ed1748ae
commit
c473238dc8
@ -352,6 +352,21 @@ static void get_buffer(struct AVCodecContext *avctx, int width, int height, int
|
||||
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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user