Zebediah Figura : strmbase: Check the peer direction in source_Connect().
Alexandre Julliard
julliard at winehq.org
Mon Apr 6 15:53:20 CDT 2020
Module: wine
Branch: master
Commit: 0c1d9312434bb47a4e8135926a79cf3a0b2f44f7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0c1d9312434bb47a4e8135926a79cf3a0b2f44f7
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Apr 5 19:49:45 2020 -0500
strmbase: Check the peer direction in source_Connect().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qcap/tests/qcap.c | 2 +-
dlls/strmbase/pin.c | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c
index 45fd98b7f9..56eaf77513 100644
--- a/dlls/qcap/tests/qcap.c
+++ b/dlls/qcap/tests/qcap.c
@@ -1433,7 +1433,7 @@ static void test_AviMux(char *arg)
pin, &source_filter.IPin_iface);
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);
ok(hr == S_OK, "JoinFilterGraph returned %x\n", hr);
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index b2a0c39110..4676c9d82b 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -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);
AM_MEDIA_TYPE candidate, *candidate_ptr;
IEnumMediaTypes *enummt;
+ PIN_DIRECTION dir;
unsigned int i;
ULONG count;
HRESULT hr;
@@ -458,10 +459,12 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP
if (!peer)
return E_POINTER;
- /* If we try to connect to ourselves, we will definitely deadlock.
- * There are other cases where we could deadlock too, but this
- * catches the obvious case */
- assert(peer != iface);
+ IPin_QueryDirection(peer, &dir);
+ if (dir != PINDIR_INPUT)
+ {
+ WARN("Attempt to connect to another source pin, returning VFW_E_INVALID_DIRECTION.\n");
+ return VFW_E_INVALID_DIRECTION;
+ }
EnterCriticalSection(&pin->pin.filter->csFilter);
More information about the wine-cvs
mailing list