quartz: Properly handle input parameters in FileSource_GetCurFile

Chris Robinson chris.kcat at gmail.com
Tue Feb 13 16:28:02 CST 2007


Some of the codecs in the K-Lite Codec Pack crash here from NULL pointer 
derefs. MSDN says the function is aware of NULL parameters, so deal with 
them.
-------------- next part --------------
From 6bf9dcf31d21e9c9a647623fa553465096957b6c Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat at gmail.com>
Date: Tue, 13 Feb 2007 05:02:55 -0800
Subject: [PATCH] quartz: Properly handle input parameters in FileSource_GetCurFile

---
 dlls/quartz/filesource.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 786252f..691413d 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -637,6 +637,9 @@ static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter * iface, LPOLESTR
     
     TRACE("(%p, %p)\n", ppszFileName, pmt);
 
+    if (!ppszFileName)
+        return E_POINTER;
+
     /* copy file name & media type if available, otherwise clear the outputs */
     if (This->pszFileName)
     {
@@ -646,12 +649,13 @@ static HRESULT WINAPI FileSource_GetCurFile(IFileSourceFilter * iface, LPOLESTR
     else
         *ppszFileName = NULL;
 
-    if (This->pmt)
+    if (pmt)
     {
-        CopyMediaType(pmt, This->pmt);
+        if (This->pmt)
+            CopyMediaType(pmt, This->pmt);
+        else
+            ZeroMemory(pmt, sizeof(*pmt));
     }
-    else
-        ZeroMemory(pmt, sizeof(*pmt));
 
     return S_OK;
 }
-- 
1.4.4.4



More information about the wine-patches mailing list