[PATCH] Don't crash on invalid .def file

Christopher Faylor me@cgf.cx
Tue Sep 28 15:01:00 GMT 2004


On Tue, Sep 28, 2004 at 02:11:23AM +0200, Filip Navara wrote:
>Filip Navara wrote:
>>Abstract:
>>
>>When an unparsable .def file is passed on command line to "ld" an crash 
>>happens. This is because def_file_parse deletes the def_file context 
>>that was passed to it and gld_i386pe_unrecognized_file still treats it 
>>as a valid pointer and operates with it...
>>
>
>Sorry, use the attached patch instead...

I've applied this patch.

Thanks.

cgf

Changelog:

2004-09-27  Filip Navara  <navaraf@reactos.com>

        * emultempl/pe.em (gld_${EMULATION_NAME}_unrecognized_file):
        Prevent crash with invalid .def files.

--- ld/emultempl/pe.em  Sat Sep 18 13:45:56 2004
+++ ld/emultempl/pe.em  Tue Sep 28 01:23:08 2004
@@ -1291,10 +1291,7 @@

   if (strcmp (ext, ".def") == 0 || strcmp (ext, ".DEF") == 0)
     {
-      if (pe_def_file == 0)
-       pe_def_file = def_file_empty ();
-
-      def_file_parse (entry->filename, pe_def_file);
+      pe_def_file = def_file_parse (entry->filename, pe_def_file);

       if (pe_def_file)
        {



More information about the Binutils mailing list