]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Fload dangling pointer
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Apr 2019 19:55:18 +0000 (12:55 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Apr 2019 19:57:30 +0000 (12:57 -0700)
* src/lread.c (Fload): Expand decl’s lifetime to match its use.
Bug found by gcc -fsanitize=address.

src/lread.c

index f83db2ac9f952f3e4af552de26109a7576e9e61c..6cd1029cd9f472387d96cf1437d5ebb8e8cf7f04 100644 (file)
@@ -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;