From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#11243: decode_env_path garbage-collection bug Date: Sat, 14 Apr 2012 00:09:39 -0700 Organization: UCLA Computer Science Department Message-ID: <4F8922B3.8020207@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1334387452 29242 80.91.229.3 (14 Apr 2012 07:10:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 14 Apr 2012 07:10:52 +0000 (UTC) To: 11243@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 14 09:10:51 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SIx8A-0005TD-PD for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Apr 2012 09:10:47 +0200 Original-Received: from localhost ([::1]:50886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx89-0002gV-SA for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Apr 2012 03:10:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx86-0002fp-KV for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:10:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIx84-0007at-N7 for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:10:42 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx84-0007ah-Ij for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:10:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SIx9O-0002Aq-Eu for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Apr 2012 07:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11243 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13343874758301 (code B ref -1); Sat, 14 Apr 2012 07:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Apr 2012 07:11:15 +0000 Original-Received: from localhost ([127.0.0.1]:57929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIx8b-00029n-Bv for submit@debbugs.gnu.org; Sat, 14 Apr 2012 03:11:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55322) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIx8W-00029e-TZ for submit@debbugs.gnu.org; Sat, 14 Apr 2012 03:11:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIx7A-0006wZ-NA for submit@debbugs.gnu.org; Sat, 14 Apr 2012 03:09:45 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:46235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx7A-0006wS-K0 for submit@debbugs.gnu.org; Sat, 14 Apr 2012 03:09:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx79-0002JQ-07 for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:09:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIx76-0006v9-U7 for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:09:42 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:52668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIx76-0006uE-Od for bug-gnu-emacs@gnu.org; Sat, 14 Apr 2012 03:09:40 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 74B39A60002 for ; Sat, 14 Apr 2012 00:09:38 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QU-3nIFbxI8e for ; Sat, 14 Apr 2012 00:09:37 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C059839E800D for ; Sat, 14 Apr 2012 00:09:37 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:59034 Archived-At: 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 + Fix possible memory crash in decode_env_path. + * emacs.c (decode_env_path): GCPRO locals. + +2012-04-14 Paul Eggert + 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,