[MPlayer-dev-eng] [PATCH] Wrong typecast in loader/dshow/output.c
Vladimir Voroshilov
voroshil at gmail.com
Sat Jan 27 21:03:10 CET 2007
COutputMemPin_Queryinterface belongs to COutputMemPin, but casts This
parameter as COutputPin. This does not affect until DirectShow call
QueryInterface to retrive IMemInputPin from COutputMemPin. For
example:
Example1:
pPin->vt->QueryInterface(pPin,&IID_IMemInputPin,&pMemPin1); // FINE
pPin->vt->QueryInterface(pPin,&IID_IMemInputPin,&pMemPin2); // FINE
Example2:
pPin->vt->QueryInterface(pPin,&IID_IMemInputPin,&pMemPin1); // FINE
pMemPin1->vt->QueryInterface(pMemPin1,&IID_IMemInputPin,&pMemPin2);
//Should crash
Seem like DirectShow binary codecs usually does not query IMemInputPin
interface from IMemInputPin and thus all works fine.
Attached patch fixes this bug.
I have tested it under Linux with divxds dshow codec and all works fine.
Opinions?
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
Index: outputpin.c
===================================================================
--- outputpin.c (revision 22035)
+++ outputpin.c (working copy)
@@ -587,7 +587,7 @@
*/
static HRESULT STDCALL COutputMemPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
{
- COutputPin* p = (COutputPin*)This;
+ COutputMemPin* p = (COutputMemPin*)This;
Debug printf("COutputMemPin_QueryInterface(%p) called\n", This);
if (!ppv)
@@ -608,8 +608,8 @@
}*/
if(!memcmp(iid, &IID_IMemInputPin, 16))
{
- *ppv = p->mempin;
- p->mempin->vt->AddRef(This);
+ *ppv = p;
+ p->vt->AddRef(This);
return 0;
}
Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
More information about the MPlayer-dev-eng
mailing list