Mercurial > mplayer.hg
changeset 1805:2abc322c0516
Fix two memory accesses to unallocated memory (detected by electric fence)
author | jkeil |
---|---|
date | Fri, 31 Aug 2001 19:19:15 +0000 |
parents | 76b4f7bcd087 |
children | 44d4f1e9afb0 |
files | loader/dshow/DS_VideoDecoder.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/loader/dshow/DS_VideoDecoder.c Fri Aug 31 18:46:45 2001 +0000 +++ b/loader/dshow/DS_VideoDecoder.c Fri Aug 31 19:19:15 2001 +0000 @@ -63,7 +63,8 @@ m_sOurType.pbFormat = (char*)m_sVhdr; m_sVhdr2 = (VIDEOINFOHEADER*)(new char[sizeof(VIDEOINFOHEADER)+12]); - memcpy(m_sVhdr2, m_sVhdr, sizeof(VIDEOINFOHEADER)+12); + memcpy(m_sVhdr2, m_sVhdr, sizeof(VIDEOINFOHEADER)); + memset((char*)m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12); m_sVhdr2->bmiHeader.biCompression = 0; m_sVhdr2->bmiHeader.biBitCount = 24; @@ -79,7 +80,8 @@ m_sDestType.pUnk = 0; m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); m_sDestType.pbFormat = (char*)m_sVhdr2; - memcpy(&m_obh, m_bh, sizeof(m_obh)); + memset(&m_obh, 0, sizeof(m_obh)); + memcpy(&m_obh, m_bh, sizeof(m_obh) < m_bh->biSize ? sizeof(m_obh) : m_bh->biSize); m_obh.SetBits(24); HRESULT result;