[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0f86284 3/3: Fix Fload dangling pointer
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 0f86284 3/3: Fix Fload dangling pointer |
Date: |
Fri, 19 Apr 2019 15:57:36 -0400 (EDT) |
branch: master
commit 0f8628490e3e06f2bfe14451626f55b2165d711c
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix Fload dangling pointer
* src/lread.c (Fload): Expand decl’s lifetime to match its use.
Bug found by gcc -fsanitize=address.
---
src/lread.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lread.c b/src/lread.c
index f83db2a..6cd1029 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1439,6 +1439,10 @@ Return t if the file exists and loads successfully. */)
specbind (Qinhibit_file_name_operation, Qnil);
specbind (Qload_in_progress, Qt);
+ /* Declare here rather than inside the else-part because the storage
+ might be accessed by the unbind_to call below. */
+ struct infile input;
+
if (is_module)
{
#ifdef HAVE_MODULES
@@ -1453,7 +1457,6 @@ Return t if the file exists and loads successfully. */)
}
else
{
- struct infile input;
input.stream = stream;
input.lookahead = 0;
infile = &input;