Andrey Turkin : dbghelp: Avoid crashing on files with bogus export table.

Alexandre Julliard julliard at winehq.org
Wed Oct 10 06:46:12 CDT 2007


Module: wine
Branch: master
Commit: 4c8e88df7e6e281561339dcbd517809c82ae27d4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4c8e88df7e6e281561339dcbd517809c82ae27d4

Author: Andrey Turkin <andrey.turkin at gmail.com>
Date:   Mon Oct  8 21:41:37 2007 +0400

dbghelp: Avoid crashing on files with bogus export table.

---

 dlls/dbghelp/pe_module.c |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c
index a42ade1..3027f5b 100644
--- a/dlls/dbghelp/pe_module.c
+++ b/dlls/dbghelp/pe_module.c
@@ -248,25 +248,28 @@ static BOOL pe_load_export_debug_info(const struct process* pcs,
         ordinals  = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNameOrdinals, NULL);
         names     = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNames, NULL);
 
-        for (i = 0; i < exports->NumberOfNames; i++) 
+        if (functions && ordinals && names)
         {
-            if (!names[i]) continue;
-            symt_new_public(module, NULL, 
-                            RtlImageRvaToVa(nth, (void*)mapping, names[i], NULL),
-                            base + functions[ordinals[i]], 
-                            1, TRUE /* FIXME */, TRUE /* FIXME */);
-        }
-	    
-        for (i = 0; i < exports->NumberOfFunctions; i++) 
-        {
-            if (!functions[i]) continue;
-            /* Check if we already added it with a name */
-            for (j = 0; j < exports->NumberOfNames; j++)
-                if ((ordinals[j] == i) && names[j]) break;
-            if (j < exports->NumberOfNames) continue;
-            snprintf(buffer, sizeof(buffer), "%d", i + exports->Base);
-            symt_new_public(module, NULL, buffer, base + (DWORD)functions[i], 1,
-                            TRUE /* FIXME */, TRUE /* FIXME */);
+            for (i = 0; i < exports->NumberOfNames; i++)
+            {
+                if (!names[i]) continue;
+                symt_new_public(module, NULL,
+                                RtlImageRvaToVa(nth, (void*)mapping, names[i], NULL),
+                                base + functions[ordinals[i]],
+                                1, TRUE /* FIXME */, TRUE /* FIXME */);
+            }
+
+            for (i = 0; i < exports->NumberOfFunctions; i++)
+            {
+                if (!functions[i]) continue;
+                /* Check if we already added it with a name */
+                for (j = 0; j < exports->NumberOfNames; j++)
+                    if ((ordinals[j] == i) && names[j]) break;
+                if (j < exports->NumberOfNames) continue;
+                snprintf(buffer, sizeof(buffer), "%d", i + exports->Base);
+                symt_new_public(module, NULL, buffer, base + (DWORD)functions[i], 1,
+                                TRUE /* FIXME */, TRUE /* FIXME */);
+            }
         }
     }
     /* no real debug info, only entry points */




More information about the wine-cvs mailing list