aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/w32proc.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index 8e878e6ef3e..75e345a525a 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1776,22 +1776,27 @@ w32_executable_type (char * filename,
1776 if (data_dir) 1776 if (data_dir)
1777 { 1777 {
1778 /* Look for Cygwin DLL in the DLL import list. */ 1778 /* Look for Cygwin DLL in the DLL import list. */
1779 IMAGE_DATA_DIRECTORY import_dir = 1779 IMAGE_DATA_DIRECTORY import_dir
1780 data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; 1780 = data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT];
1781 1781
1782 /* Import directory can be missing in .NET DLLs. */ 1782 /* Import directory can be missing in .NET DLLs. */
1783 if (import_dir.VirtualAddress != 0) 1783 if (import_dir.VirtualAddress != 0)
1784 { 1784 {
1785 IMAGE_SECTION_HEADER *section
1786 = rva_to_section (import_dir.VirtualAddress, nt_header);
1787 if (!section)
1788 emacs_abort ();
1789
1785 IMAGE_IMPORT_DESCRIPTOR * imports = 1790 IMAGE_IMPORT_DESCRIPTOR * imports =
1786 RVA_TO_PTR (import_dir.VirtualAddress, 1791 RVA_TO_PTR (import_dir.VirtualAddress, section,
1787 rva_to_section (import_dir.VirtualAddress,
1788 nt_header),
1789 executable); 1792 executable);
1790 1793
1791 for ( ; imports->Name; imports++) 1794 for ( ; imports->Name; imports++)
1792 { 1795 {
1793 IMAGE_SECTION_HEADER * section = 1796 section = rva_to_section (imports->Name, nt_header);
1794 rva_to_section (imports->Name, nt_header); 1797 if (!section)
1798 emacs_abort ();
1799
1795 char * dllname = RVA_TO_PTR (imports->Name, section, 1800 char * dllname = RVA_TO_PTR (imports->Name, section,
1796 executable); 1801 executable);
1797 1802