aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-09-22 17:37:22 +0300
committerEli Zaretskii2014-09-22 17:37:22 +0300
commitf11af8a48cfef05314e6e5d86e18861cffbde9f1 (patch)
treec054f3ed5855b72d0330e8adf0f13cd208281a16
parent601a0cfe861eac8ed706a2bb3380c5788a1ef701 (diff)
downloademacs-f11af8a48cfef05314e6e5d86e18861cffbde9f1.tar.gz
emacs-f11af8a48cfef05314e6e5d86e18861cffbde9f1.zip
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.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/fileio.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b7858c609b4..5aad2f91834 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-09-22 Eli Zaretskii <eliz@gnu.org>
2
3 * fileio.c (Fexpand_file_name) [DOS_NT]: Make sure newdirlim is
4 always set to a valid value. Make sure the size passed to alloca
5 is always positive. (Bug#18516)
6
12014-09-22 Dmitry Antipov <dmantipov@yandex.ru> 72014-09-22 Dmitry Antipov <dmantipov@yandex.ru>
2 8
3 Avoid extra call to oblookup when interning symbols. 9 Avoid extra call to oblookup when interning symbols.
diff --git a/src/fileio.c b/src/fileio.c
index 80905c63d3a..13e2c889020 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1237,6 +1237,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1237 newdirlim = adir + SBYTES (tem); 1237 newdirlim = adir + SBYTES (tem);
1238 memcpy (adir, SSDATA (tem), SBYTES (tem) + 1); 1238 memcpy (adir, SSDATA (tem), SBYTES (tem) + 1);
1239 } 1239 }
1240 else
1241 newdirlim = adir + strlen (adir);
1240 } 1242 }
1241 if (!adir) 1243 if (!adir)
1242 { 1244 {
@@ -1383,6 +1385,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1383 1385
1384 /* Now concatenate the directory and name to new space in the stack frame. */ 1386 /* Now concatenate the directory and name to new space in the stack frame. */
1385 tlen = length + file_name_as_directory_slop + (nmlim - nm) + 1; 1387 tlen = length + file_name_as_directory_slop + (nmlim - nm) + 1;
1388 eassert (tlen > file_name_as_directory_slop + 1);
1386#ifdef DOS_NT 1389#ifdef DOS_NT
1387 /* Reserve space for drive specifier and escape prefix, since either 1390 /* Reserve space for drive specifier and escape prefix, since either
1388 or both may need to be inserted. (The Microsoft x86 compiler 1391 or both may need to be inserted. (The Microsoft x86 compiler