[PATCH v2] quartz: Don't call memcpy with src=0 in FM2_WriteFilterData (Coverity)

Alex Henrie alexhenrie24 at gmail.com
Mon Aug 13 17:33:21 CDT 2018


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
Passing NULL to memcpy causes a segfault in newer versions of GCC, see
https://www.imperialviolet.org/2016/06/26/nonnull.html

v2: Fixed email address
---
 dlls/quartz/filtermapper.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index 0d26198637..7a5b5aee72 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -148,8 +148,11 @@ static int add_data(struct Vector * v, const BYTE * pData, int size)
         LPBYTE pOldData = v->pData;
         v->capacity = (v->capacity + size) * 2;
         v->pData = CoTaskMemAlloc(v->capacity);
-        memcpy(v->pData, pOldData, v->current);
-        CoTaskMemFree(pOldData);
+        if (pOldData)
+        {
+            memcpy(v->pData, pOldData, v->current);
+            CoTaskMemFree(pOldData);
+        }
     }
     memcpy(v->pData + v->current, pData, size);
     v->current += size;
-- 
2.18.0




More information about the wine-devel mailing list