bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11243: decode_env_path garbage-collection bug


From: Paul Eggert
Subject: bug#11243: decode_env_path garbage-collection bug
Date: Sat, 14 Apr 2012 00:09:39 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Tags: patch

Here's the obvious patch, which I plan to install in the
trunk after a bit more testing.

=== modified file 'src/ChangeLog'
--- src/ChangeLog       2012-04-14 06:18:49 +0000
+++ src/ChangeLog       2012-04-14 07:06:24 +0000
@@ -1,5 +1,10 @@
 2012-04-14  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Fix possible memory crash in decode_env_path.
+       * emacs.c (decode_env_path): GCPRO locals.
+
+2012-04-14  Paul Eggert  <eggert@cs.ucla.edu>
+
        Make GC_MAKE_GCPROS_NOOPS the default (Bug#9926).
        * lisp.h (GC_MARK_STACK): Default to GC_MAKE_GCPROS_NOOPS.
        * s/cygwin.h, s/darwin.h, s/freebsd.h, s/gnu.h, s/irix6-5.h, s/msdos.h:

=== modified file 'src/emacs.c'
--- src/emacs.c 2012-04-07 13:57:36 +0000
+++ src/emacs.c 2012-04-14 07:06:24 +0000
@@ -2285,6 +2285,7 @@
 {
   const char *path, *p;
   Lisp_Object lpath, element, tem;
+  struct gcpro gcpro1, gcpro2;
 
   /* It's okay to use getenv here, because this function is only used
      to initialize variables when Emacs starts up, and isn't called
@@ -2305,7 +2306,8 @@
       path = path_copy;
     }
 #endif
-  lpath = Qnil;
+  lpath = element = Qnil;
+  GCPRO2 (lpath, element);
   while (1)
     {
       p = strchr (path, SEPCHAR);
@@ -2337,7 +2339,7 @@
       else
        break;
     }
-  return Fnreverse (lpath);
+  RETURN_UNGCPRO (Fnreverse (lpath));
 }
 
 DEFUN ("daemonp", Fdaemonp, Sdaemonp, 0, 0, 0,





reply via email to

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