From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Check if argv[0] is NULL in scm_boot_guile to avoid segfault Date: Sat, 11 Oct 2014 13:05:45 -0400 Message-ID: <87vbnqiljq.fsf@yeeloong.lan> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1413047215 22764 80.91.229.3 (11 Oct 2014 17:06:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Oct 2014 17:06:55 +0000 (UTC) Cc: 18680-done@debbugs.gnu.org, Andy Wingo , guile-devel@gnu.org To: Nala Ginrut Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Oct 11 19:06:47 2014 Return-path: Envelope-to: guile-devel@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 1Xd07y-0002EO-P2 for guile-devel@m.gmane.org; Sat, 11 Oct 2014 19:06:46 +0200 Original-Received: from localhost ([::1]:54753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd07y-0006wL-4a for guile-devel@m.gmane.org; Sat, 11 Oct 2014 13:06:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd07m-0006v9-El for guile-devel@gnu.org; Sat, 11 Oct 2014 13:06:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xd07e-0003dB-VF for guile-devel@gnu.org; Sat, 11 Oct 2014 13:06:34 -0400 Original-Received: from world.peace.net ([96.39.62.75]:37212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd07W-0003ay-W9; Sat, 11 Oct 2014 13:06:19 -0400 Original-Received: from c-24-62-95-23.hsd1.ma.comcast.net ([24.62.95.23] helo=yeeloong.lan) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xd07Q-0007Zc-UA; Sat, 11 Oct 2014 13:06:13 -0400 In-Reply-To: (Nala Ginrut's message of "Sat, 11 Oct 2014 00:15:25 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17581 Archived-At: Nala Ginrut writes: > This patch is for master branch, but the bug also appears in the > current stable-2.0 I think. > > With the recent patch from Eli Zaretskii, there'd be one more step for argv[0]: > scm_i_mirror_backslashes (argv[0]); > > But this cause my program segfault, since I have such line: > scm_boot_guile(0, {NULL}, &guilemain, NULL); > > According to C11, it's allowed[1]. > argv[argc] should be NULL. > If the value of argc is greater than zero, the string pointed to by argv[0] > represents the program name. But if argc is zero, argv[0] will be NULL, so > we have to check it first to avoid segfault. Fixed in b9ace68613395fda26f3f3d7dc2ac9bc52cd7f2a on the stable-2.0 branch. It'll go into master on the next merge. Thanks, Mark