unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11243: decode_env_path garbage-collection bug
@ 2012-04-14  7:09 Paul Eggert
  0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2012-04-14  7:09 UTC (permalink / raw)
  To: 11243

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,





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-14  7:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-14  7:09 bug#11243: decode_env_path garbage-collection bug Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).