quartz: Fix NULL pointer dereference (Coverity)

Nikolay Sivov bunglehead at gmail.com
Mon Jan 26 19:07:37 CST 2009


Actually reported bug belongs to both arguments..Confirmed with tests.

Changelog:
    - Fix NULL pointer dereference (Coverity)

>From 4f4bb3ff6eb23512c0902f7a55201cb51d5d6125 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 27 Jan 2009 04:05:00 +0300
Subject: Fix NULL pointer dereference (Coverity)

---
 dlls/quartz/control.c           |    4 ++--
 dlls/quartz/tests/filtergraph.c |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/control.c b/dlls/quartz/control.c
index 36a610e..d14e221 100644
--- a/dlls/quartz/control.c
+++ b/dlls/quartz/control.c
@@ -591,9 +591,9 @@ HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * p
     This->llCurrent = llNewCurrent;
     This->llStop = llNewStop;
 
-    if (dwCurrentFlags & AM_SEEKING_ReturnTime)
+    if (pCurrent && (dwCurrentFlags & AM_SEEKING_ReturnTime))
         *pCurrent = llNewCurrent;
-    if (dwStopFlags & AM_SEEKING_ReturnTime)
+    if (pStop && (dwStopFlags & AM_SEEKING_ReturnTime))
         *pStop = llNewStop;
 
     ForwardCmdSeek(This->crst, This->pUserData, fwd_setposition, &args);
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 6f9e4c8..2e5fdc4 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -272,6 +272,11 @@ 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 = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning);
+    ok(hr == S_OK, "SetPositions failed: %08x\n", hr);
+    hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime);
+    ok(hr == S_OK, "SetPositions failed: %08x\n", hr);
+
     IMediaFilter_SetSyncSource(filter, NULL);
     pos = 0xdeadbeef;
     hr = IMediaSeeking_GetCurrentPosition(seeking, &pos);
-- 
1.5.6.5






More information about the wine-patches mailing list