diff --git a/dlls/amstream/mediastreamfilter.c b/dlls/amstream/mediastreamfilter.c index 49ee6fe7b8c..defabd9f895 100644 --- a/dlls/amstream/mediastreamfilter.c +++ b/dlls/amstream/mediastreamfilter.c @@ -367,7 +367,8 @@ static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* i /* Pin name is "I{guid MSPID_PrimaryVideo or MSPID_PrimaryAudio}" */ info.achName[0] = 'I'; StringFromGUID2(&purpose_id, info.achName + 1, 40); - hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, &info, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]); + hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, sizeof(BaseInputPin), &info, &input_BaseFuncTable, + &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]); if (FAILED(hr)) return hr; diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 750752e733e..d99a0bb460a 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -1237,7 +1237,7 @@ static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPi return S_OK; } -HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, +HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, IPin ** ppPin) { @@ -1245,6 +1245,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * p *ppPin = NULL; + assert(inputpin_size >= sizeof(BaseInputPin)); assert(pBaseFuncsTable->pfnCheckMediaType); if (pPinInfo->dir != PINDIR_INPUT) @@ -1253,7 +1254,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * p return E_INVALIDARG; } - pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl)); + pPinImpl = CoTaskMemAlloc(inputpin_size); if (!pPinImpl) return E_OUTOFMEMORY; diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 8bbb1f81130..56f72f1a7ef 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -253,7 +253,8 @@ HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtb piInput.pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); - hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin); + hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, &input_BaseFuncTable, + &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin); if (SUCCEEDED(hr)) { diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index df72d999b4f..2290bedd0a5 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -225,7 +225,8 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p piOutput.pFilter = &pTransformFilter->filter.IBaseFilter_iface; lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0])); - hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, &tf_input_BaseFuncTable, &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]); + hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, &tf_input_BaseFuncTable, + &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]); if (SUCCEEDED(hr)) { diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index ecb53c41c6d..b2046d4db11 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -145,7 +145,9 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); -HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); +HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo, + const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, + LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); typedef struct BaseFilter {