Segfault in winedump (spotted by valgrind)

Eric Pouech pouech-eric at wanadoo.fr
Sat Dec 20 11:56:26 CST 2003


Sylvain Petreolle wrote:
> Trying to dump a winme dll,
> winedump crashed with a segfault.

Does this patch helps ?
A+


-- 
Eric Pouech
-------------- next part --------------
Index: tools/winedump/main.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/tools/winedump/main.c,v
retrieving revision 1.13
diff -u -r1.13 main.c
--- tools/winedump/main.c	13 May 2003 04:47:53 -0000	1.13
+++ tools/winedump/main.c	20 Dec 2003 17:53:58 -0000
@@ -404,7 +404,8 @@
         if (globals.input_name == NULL)
             fatal("No file name has been given\n");
 	set_module_name(1);
-	dll_open (globals.input_name);
+	if (!dll_open (globals.input_name))
+            break;
 
 	output_spec_preamble ();
 	output_header_preamble ();
Index: tools/winedump/pe.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/tools/winedump/pe.c,v
retrieving revision 1.30
diff -u -r1.30 pe.c
--- tools/winedump/pe.c	11 Nov 2003 22:04:33 -0000	1.30
+++ tools/winedump/pe.c	20 Dec 2003 17:54:48 -0000
@@ -1224,9 +1224,9 @@
  *
  * Open a DLL and read in exported symbols
  */
-void  dll_open (const char *dll_name)
+int dll_open (const char *dll_name)
 {
-    pe_analysis(dll_name, do_grab_sym, SIG_PE);
+    return pe_analysis(dll_name, do_grab_sym, SIG_PE);
 }
 
 /*******************************************************************
Index: tools/winedump/winedump.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/tools/winedump/winedump.h,v
retrieving revision 1.8
diff -u -r1.8 winedump.h
--- tools/winedump/winedump.h	26 Nov 2003 03:55:01 -0000	1.8
+++ tools/winedump/winedump.h	20 Dec 2003 17:54:29 -0000
@@ -157,9 +157,9 @@
 void	dump_file(const char* name);
 
 /* DLL functions */
-void  dll_open (const char *dll_name);
+int   dll_open (const char *dll_name);
 
-int dll_next_symbol (parsed_symbol * sym);
+int   dll_next_symbol (parsed_symbol * sym);
 
 /* Symbol functions */
 int   symbol_init(parsed_symbol* symbol, const char* name);


More information about the wine-devel mailing list