[Mplayer-cvslog] CVS: main/loader/DirectShow DS_VideoDecoder.cpp,1.3,1.4

Jürgen Keil jkeil at mplayer.dev.hu
Fri Aug 31 21:19:17 CEST 2001


Update of /cvsroot/mplayer/main/loader/DirectShow
In directory mplayer:/var/tmp.root/cvs-serv2561

Modified Files:
	DS_VideoDecoder.cpp 
Log Message:
Fix two memory accesses to unallocated memory (detected by electric fence)


Index: DS_VideoDecoder.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_VideoDecoder.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DS_VideoDecoder.cpp	20 Aug 2001 11:31:34 -0000	1.3
+++ DS_VideoDecoder.cpp	31 Aug 2001 19:19:15 -0000	1.4
@@ -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;




More information about the MPlayer-cvslog mailing list