emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117918: Fix bug #18516 with SIGSEGV in expand-file-


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r117918: Fix bug #18516 with SIGSEGV in expand-file-name.
Date: Mon, 22 Sep 2014 14:38:26 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117918
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18516
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2014-09-22 17:37:22 +0300
message:
  Fix bug #18516 with SIGSEGV in expand-file-name.
  
   src/fileio.c (Fexpand_file_name) [DOS_NT]: Make sure newdirlim is
   always set to a valid value.  Make sure the size passed to alloca
   is always positive.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/fileio.c                   fileio.c-20091113204419-o5vbwnq5f7feedwu-210
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-22 06:06:19 +0000
+++ b/src/ChangeLog     2014-09-22 14:37:22 +0000
@@ -1,3 +1,9 @@
+2014-09-22  Eli Zaretskii  <address@hidden>
+
+       * fileio.c (Fexpand_file_name) [DOS_NT]: Make sure newdirlim is
+       always set to a valid value.  Make sure the size passed to alloca
+       is always positive.  (Bug#18516)
+
 2014-09-22  Dmitry Antipov  <address@hidden>
 
        Avoid extra call to oblookup when interning symbols.

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2014-09-16 08:20:08 +0000
+++ b/src/fileio.c      2014-09-22 14:37:22 +0000
@@ -1237,6 +1237,8 @@
              newdirlim = adir + SBYTES (tem);
              memcpy (adir, SSDATA (tem), SBYTES (tem) + 1);
            }
+         else
+           newdirlim = adir + strlen (adir);
        }
       if (!adir)
        {
@@ -1383,6 +1385,7 @@
 
   /* Now concatenate the directory and name to new space in the stack frame.  
*/
   tlen = length + file_name_as_directory_slop + (nmlim - nm) + 1;
+  eassert (tlen > file_name_as_directory_slop + 1);
 #ifdef DOS_NT
   /* Reserve space for drive specifier and escape prefix, since either
      or both may need to be inserted.  (The Microsoft x86 compiler


reply via email to

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