Sanity-check sh_video->bih->biSize

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21985 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-01-21 18:22:07 +00:00
parent 4b9ddc69a0
commit 75282a6a83
2 changed files with 4 additions and 0 deletions

View File

@ -420,6 +420,8 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
sh_video->bih=calloc((len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len,1);
memcpy(sh_video->bih,&buffer[4+4+1+2],len);
le2me_BITMAPINFOHEADER(sh_video->bih);
if (sh_video->bih->biSize > len && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
sh_video->bih->biSize = len;
if (sh_video->bih->biCompression == mmioFOURCC('D', 'V', 'R', ' ')) {
//mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
//sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;

View File

@ -262,6 +262,8 @@ while(1){
mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER));
stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian
if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
sh_video->bih->biSize = chunksize;
// fixup MS-RLE header (seems to be broken for <256 color files)
if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
sh_video->bih->biSize=chunksize;