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

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

[debbugs-tracker] bug#18680: closed ([PATCH] Check if argv[0] is NULL in


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#18680: closed ([PATCH] Check if argv[0] is NULL in scm_boot_guile to avoid segfault)
Date: Sat, 11 Oct 2014 17:07:02 +0000

Your message dated Sat, 11 Oct 2014 13:05:45 -0400
with message-id <address@hidden>
and subject line Re: [PATCH] Check if argv[0] is NULL in scm_boot_guile to 
avoid segfault
has caused the debbugs.gnu.org bug report #18680,
regarding [PATCH] Check if argv[0] is NULL in scm_boot_guile to avoid segfault
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
18680: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18680
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] Check if argv[0] is NULL in scm_boot_guile to avoid segfault Date: Sat, 11 Oct 2014 00:15:25 +0800
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.

Attached patch fixed this.

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

Attachment: 0001-Check-argv-0-if-it-s-NULL-in-scm_boot_guile.patch
Description: Text Data


--- End Message ---
--- Begin Message --- 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 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (gnu/linux)
Nala Ginrut <address@hidden> 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


--- End Message ---

reply via email to

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