diff options
| author | Koichi Arakawa | 2015-04-06 13:26:54 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-04-06 13:26:54 +0300 |
| commit | eedff18424041188c843fb8e183b686df6c217f2 (patch) | |
| tree | 30503b994a48376bd3669b856dde5617345d32e9 | |
| parent | 7471fc47b4bc78ed1a55e045ddb2d0b3eba19305 (diff) | |
| download | emacs-eedff18424041188c843fb8e183b686df6c217f2.tar.gz emacs-eedff18424041188c843fb8e183b686df6c217f2.zip | |
Avoid segfaults on MS-Windows when invoking subprocesses (Bug#20264)
src/w32proc.c (w32_executable_type): Look for the DLL name in the
correct section. This avoids segfaults with some executables.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32proc.c | 21 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1c3f933d7d8..33d0b9b9521 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-04-06 Koichi Arakawa <arakawa@pp.iij4u.or.jp> (tiny change) | ||
| 2 | |||
| 3 | * w32proc.c (w32_executable_type): Look for the DLL name in the | ||
| 4 | correct section. This avoids segfaults with some executables. | ||
| 5 | (Bug#20264) | ||
| 6 | |||
| 1 | 2015-04-04 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2015-04-04 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * xselect.c (x_reply_selection_request) | 9 | * xselect.c (x_reply_selection_request) |
diff --git a/src/w32proc.c b/src/w32proc.c index 7d982f831e2..9f699ccf65b 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1613,24 +1613,25 @@ w32_executable_type (char * filename, | |||
| 1613 | #endif | 1613 | #endif |
| 1614 | if (data_dir) | 1614 | if (data_dir) |
| 1615 | { | 1615 | { |
| 1616 | /* Look for cygwin.dll in DLL import list. */ | 1616 | /* Look for Cygwin DLL in the DLL import list. */ |
| 1617 | IMAGE_DATA_DIRECTORY import_dir = | 1617 | IMAGE_DATA_DIRECTORY import_dir = |
| 1618 | data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; | 1618 | data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; |
| 1619 | IMAGE_IMPORT_DESCRIPTOR * imports; | 1619 | IMAGE_IMPORT_DESCRIPTOR * imports = |
| 1620 | IMAGE_SECTION_HEADER * section; | 1620 | RVA_TO_PTR (import_dir.VirtualAddress, |
| 1621 | 1621 | rva_to_section (import_dir.VirtualAddress, | |
| 1622 | section = rva_to_section (import_dir.VirtualAddress, nt_header); | 1622 | nt_header), |
| 1623 | imports = RVA_TO_PTR (import_dir.VirtualAddress, section, | 1623 | executable); |
| 1624 | executable); | ||
| 1625 | 1624 | ||
| 1626 | for ( ; imports->Name; imports++) | 1625 | for ( ; imports->Name; imports++) |
| 1627 | { | 1626 | { |
| 1627 | IMAGE_SECTION_HEADER * section = | ||
| 1628 | rva_to_section (imports->Name, nt_header); | ||
| 1628 | char * dllname = RVA_TO_PTR (imports->Name, section, | 1629 | char * dllname = RVA_TO_PTR (imports->Name, section, |
| 1629 | executable); | 1630 | executable); |
| 1630 | 1631 | ||
| 1631 | /* The exact name of the cygwin dll has changed with | 1632 | /* The exact name of the Cygwin DLL has changed with |
| 1632 | various releases, but hopefully this will be reasonably | 1633 | various releases, but hopefully this will be |
| 1633 | future proof. */ | 1634 | reasonably future-proof. */ |
| 1634 | if (strncmp (dllname, "cygwin", 6) == 0) | 1635 | if (strncmp (dllname, "cygwin", 6) == 0) |
| 1635 | { | 1636 | { |
| 1636 | *is_cygnus_app = TRUE; | 1637 | *is_cygnus_app = TRUE; |