emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0757b4f: Fix crashes on MS-Windows during dumping


From: Eli Zaretskii
Subject: [Emacs-diffs] master 0757b4f: Fix crashes on MS-Windows during dumping
Date: Sat, 17 Dec 2016 11:10:59 +0000 (UTC)

branch: master
commit 0757b4f2f73daa67e5c5217964b423c6a0239e95
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix crashes on MS-Windows during dumping
    
    * src/unexw32.c (get_section_info): Make extra_bss_size be the
    maximum of extra_bss_size and extra_bss_size_static.  This avoids
    computing the size of the output file smaller than it actually
    needs to be, which then causes copy_executable_and_dump_data to
    write beyond the requested size of the file mapping, thus relying
    on the OS roundup to page boundary to save us from ourselves.  See
    http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00642.html
    for the details.
    
    * lib/stdio-impl.h: Revert the workaround fix of not including
    errno.h for MinGW.
---
 lib/stdio-impl.h |    2 --
 src/unexw32.c    |    1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 1972a33..766d693 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -26,9 +26,7 @@
 # include <sys/param.h>
 #endif
 
-#ifndef __MINGW32__
 #include <errno.h>                             /* For detecting Plan9.  */
-#endif
 
 #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
diff --git a/src/unexw32.c b/src/unexw32.c
index f4183dc..5422485 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -465,6 +465,7 @@ get_section_info (file_data *p_infile)
       bss_start = min (bss_start, bss_start_static);
       bss_size = max (my_endbss, my_endbss_static) - bss_start;
       bss_section_static = 0;
+      extra_bss_size = max (extra_bss_size, extra_bss_size_static);
       extra_bss_size_static = 0;
     }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]