kernel32/tests: Test that GetOverlappedResult segfaults if 2nd or 3rd argument is null.

Florian Köberle florian at fkoeberle.de
Thu Jan 22 06:10:31 CST 2009


---
 dlls/kernel32/tests/file.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index ed893fc..86d6523 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -28,10 +28,12 @@
 #include <time.h>
 
 #include "wine/test.h"
+#include "wine/exception.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
 
+
 static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
 static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
 static BOOL (WINAPI *pReplaceFileW)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
@@ -2020,8 +2022,37 @@ static void test_overlapped(void)
 {
     OVERLAPPED ov;
     DWORD r, result;
+    BOOL segfault;
+
+
+    segfault = FALSE;
+    __TRY
+    {
+        result = 0;
+        GetOverlappedResult(0, NULL, &result, 0);
+    }
+    __EXCEPT_PAGE_FAULT
+    {
+        segfault = TRUE;
+    }
+    __ENDTRY
+    ok(segfault, "Segfault expected, if second parameter is NULL\n");
+
+
+    segfault = FALSE;
+    __TRY
+    {
+        ov.Internal = 0;
+        ov.InternalHigh = 0xabcd;
+        GetOverlappedResult(0, &ov, NULL, 0);
+    }
+    __EXCEPT_PAGE_FAULT
+    {
+        segfault = TRUE;
+    }
+    __ENDTRY
+    ok(segfault, "Segfault expected, if thrid parameter is NULL\n");
 
-    /* GetOverlappedResult crashes if the 2nd or 3rd param are NULL */
 
     memset( &ov, 0,  sizeof ov );
     result = 1;
-- 
1.5.4.3




More information about the wine-patches mailing list