ntdll: Do not segfault with snoop for files with a broken export table

Detlef Riekenberg wine.dev at web.de
Sat Sep 8 18:07:38 CDT 2007


An Example for such a file:

ntdll: Do not segfault with snoop for files with a broken export table

An Example is "GoogleDesktopSetup.exe":

exports: 0x438380  size: 107
SNOOP_SetupDLL cdc43f03 Characteristics
SNOOP_SetupDLL 65116f36 TimeDateStamp
SNOOP_SetupDLL     6a99 MajorVersion
SNOOP_SetupDLL     c48a MinorVersion
SNOOP_SetupDLL 351c5da2 Name
SNOOP_SetupDLL 0dcaecb0 Base
SNOOP_SetupDLL 746a6e7b NumberOfFunctions
SNOOP_SetupDLL 3689ba1d NumberOfNames
SNOOP_SetupDLL 7f4ea619 AddressOfFunctions
SNOOP_SetupDLL 623979fc AddressOfNames
SNOOP_SetupDLL 196b556b AddressOfNameOrdinals


-- 
 
By by ... Detlef

-------------- next part --------------
>From 01b0177467464be49ca0995e7a90bed90cd93ce8 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Sun, 9 Sep 2007 00:32:39 +0200
Subject: [PATCH] ntdll: Do not segfault with snoop for files with broken export tables
---
 dlls/ntdll/relay.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index a50ec34..a458f61 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -654,6 +654,17 @@ void SNOOP_SetupDLL(HMODULE hmod)
     name = (char *)hmod + exports->Name;
     size = size32;
 
+    /* Check for files with broken exports */
+    if (exports->Characteristics ||
+        exports->MajorVersion || 
+        HIWORD(exports->NumberOfFunctions) ||
+        HIWORD(exports->NumberOfNames)) {
+        WARN_(snoop)("snoop disabled for bad module %p: 0x%x, %u, 0x%x, 0x%x\n", hmod,
+            exports->Characteristics, exports->MajorVersion,
+            exports->NumberOfFunctions, exports->NumberOfNames);
+        return;
+    }
+
     TRACE_(snoop)("hmod=%p, name=%s\n", hmod, name);
 
     while (*dll) {
-- 
1.4.1



More information about the wine-patches mailing list