# HG changeset patch # User jkeil # Date 999285555 0 # Node ID 2abc322c05169ac101f16c329205266360afb93f # Parent 76b4f7bcd08797ece04eed0058215a41babdedcc Fix two memory accesses to unallocated memory (detected by electric fence) diff -r 76b4f7bcd087 -r 2abc322c0516 loader/dshow/DS_VideoDecoder.c --- 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;