Commit 0c1d9312 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Check the peer direction in source_Connect().

parent bd80194a
...@@ -1433,7 +1433,7 @@ static void test_AviMux(char *arg) ...@@ -1433,7 +1433,7 @@ static void test_AviMux(char *arg)
pin, &source_filter.IPin_iface); pin, &source_filter.IPin_iface);
hr = IPin_Connect(avimux_out, &source_filter.IPin_iface, NULL); hr = IPin_Connect(avimux_out, &source_filter.IPin_iface, NULL);
todo_wine ok(hr == VFW_E_INVALID_DIRECTION, "Connect returned %x\n", hr); ok(hr == VFW_E_INVALID_DIRECTION, "Connect returned %x\n", hr);
hr = IBaseFilter_JoinFilterGraph(avimux, (IFilterGraph*)&GraphBuilder, NULL); hr = IBaseFilter_JoinFilterGraph(avimux, (IFilterGraph*)&GraphBuilder, NULL);
ok(hr == S_OK, "JoinFilterGraph returned %x\n", hr); ok(hr == S_OK, "JoinFilterGraph returned %x\n", hr);
......
...@@ -447,6 +447,7 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP ...@@ -447,6 +447,7 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP
struct strmbase_source *pin = impl_source_from_IPin(iface); struct strmbase_source *pin = impl_source_from_IPin(iface);
AM_MEDIA_TYPE candidate, *candidate_ptr; AM_MEDIA_TYPE candidate, *candidate_ptr;
IEnumMediaTypes *enummt; IEnumMediaTypes *enummt;
PIN_DIRECTION dir;
unsigned int i; unsigned int i;
ULONG count; ULONG count;
HRESULT hr; HRESULT hr;
...@@ -458,10 +459,12 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP ...@@ -458,10 +459,12 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP
if (!peer) if (!peer)
return E_POINTER; return E_POINTER;
/* If we try to connect to ourselves, we will definitely deadlock. IPin_QueryDirection(peer, &dir);
* There are other cases where we could deadlock too, but this if (dir != PINDIR_INPUT)
* catches the obvious case */ {
assert(peer != iface); WARN("Attempt to connect to another source pin, returning VFW_E_INVALID_DIRECTION.\n");
return VFW_E_INVALID_DIRECTION;
}
EnterCriticalSection(&pin->pin.filter->csFilter); EnterCriticalSection(&pin->pin.filter->csFilter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment