Lei Zhang : quartz: Check input in MediaControl_GetState.

Alexandre Julliard julliard at winehq.org
Tue May 13 04:39:53 CDT 2008


Module: wine
Branch: master
Commit: a4d0d4fe360759dcfabd2c8857cd81f19ee19a3b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a4d0d4fe360759dcfabd2c8857cd81f19ee19a3b

Author: Lei Zhang <thestig at google.com>
Date:   Mon May 12 21:17:38 2008 -0700

quartz: Check input in MediaControl_GetState.

---

 dlls/quartz/filtergraph.c       |    3 +++
 dlls/quartz/tests/filtergraph.c |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index c4b31f7..bf929d2 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -1701,6 +1701,9 @@ static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface,
 
     TRACE("(%p/%p)->(%d, %p): semi-stub !!!\n", This, iface, msTimeout, pfs);
 
+    if (!pfs)
+        return E_POINTER;
+
     EnterCriticalSection(&This->cs);
 
     *pfs = This->state;
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index f1728f7..a82a685 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -232,6 +232,7 @@ static void test_mediacontrol(void)
     LONGLONG pos = 0xdeadbeef;
     IMediaSeeking *seeking = NULL;
     IMediaFilter *filter = NULL;
+    IMediaControl *control = NULL;
 
     IFilterGraph2_SetDefaultSyncSource(pgraph);
     hr = IFilterGraph2_QueryInterface(pgraph, &IID_IMediaSeeking, (void**) &seeking);
@@ -247,6 +248,15 @@ static void test_mediacontrol(void)
         return;
     }
 
+    hr = IFilterGraph2_QueryInterface(pgraph, &IID_IMediaControl, (void**) &control);
+    ok(hr == S_OK, "QueryInterface IMediaControl failed: %08x\n", hr);
+    if (FAILED(hr))
+    {
+        IUnknown_Release(seeking);
+        IUnknown_Release(filter);
+        return;
+    }
+
     hr = IMediaSeeking_GetCurrentPosition(seeking, &pos);
     ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
     ok(pos == 0, "Position != 0 (%x%08x)\n", (DWORD)(pos >> 32), (DWORD)pos);
@@ -257,6 +267,10 @@ static void test_mediacontrol(void)
     ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
     ok(pos == 0, "Position != 0 (%x%08x)\n", (DWORD)(pos >> 32), (DWORD)pos);
 
+    hr = IMediaControl_GetState(control, 1000, NULL);
+    ok(hr == E_POINTER, "GetState expected %08x, got %08x\n", E_POINTER, hr);
+
+    IUnknown_Release(control);
     IUnknown_Release(seeking);
     IUnknown_Release(filter);
     releasefiltergraph();




More information about the wine-cvs mailing list