This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Don't crash on invalid .def file
- From: Filip Navara <xnavara at volny dot cz>
- To: binutils at sources dot redhat dot com
- Date: Tue, 28 Sep 2004 01:35:41 +0200
- Subject: [PATCH] Don't crash on invalid .def file
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...
Changelog:
2004-09-27 Filip Navara <navaraf@reactos.com>
* emultempl/pe.em (gld_${EMULATION_NAME}_unrecognized_file):
Prevent crash with invalid .def files.
* deffilep.y (def_file_parse):
Don't delete the passed def_file context on error.
Changelog:
2004-09-27 Filip Navara <navaraf@reactos.com>
* emultempl/pe.em (gld_${EMULATION_NAME}_unrecognized_file):
Prevent crash with invalid .def files.
* deffilep.y (def_file_parse):
Don't delete the passed def_file context on error.
--- 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, NULL);
if (pe_def_file)
{
--- ld/deffilep.y Sun Oct 19 17:21:31 2003
+++ ld/deffilep.y Tue Sep 28 01:26:36 2004
@@ -305,7 +305,10 @@
saw_newline = 1;
if (def_parse ())
{
- def_file_free (def);
+ if (!add_to)
+ {
+ def_file_free (def);
+ }
fclose (the_file);
return 0;
}