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

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

[debbugs-tracker] bug#17499: closed (current dfa.c can malloc 0 bytes)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17499: closed (current dfa.c can malloc 0 bytes)
Date: Thu, 15 May 2014 19:45:02 +0000

Your message dated Thu, 15 May 2014 12:44:25 -0700
with message-id <address@hidden>
and subject line Re: bug#17499: current dfa.c can malloc 0 bytes
has caused the debbugs.gnu.org bug report #17499,
regarding current dfa.c can malloc 0 bytes
to be marked as done.

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


-- 
17499: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17499
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: current dfa.c can malloc 0 bytes Date: Thu, 15 May 2014 19:22:40 +0300 User-agent: Heirloom mailx 12.5 6/20/10
Hello.

It seems that code in the grep master dfa.c can call xmalloc with
an amount that is zero.  This is OK on GLIBC but is causing some failures
on other systems where malloc(0) fails.

This was not the case a while back (when gawk 4.1.1 was released in
April or so).

It'd be nice if this could be fixed sometime.  To test this in gawk,

Apply the patch below to either master or gawk-4.1-stable from the git repo
and rebuild, and make check.  Gawk 4.1.1 doesn't have this problem.

Thanks

Arnold
---------------
diff --git a/gawkmisc.c b/gawkmisc.c
index a729d88..b07281d 100644
--- a/gawkmisc.c
+++ b/gawkmisc.c
@@ -52,6 +52,8 @@ pointer
 xmalloc(size_t bytes)
 {
        pointer p;
+       if (bytes == 0)
+               fprintf(stderr, "%s: 0 bytes!\n", __func__), fflush(stderr);
        emalloc(p, pointer, bytes, "xmalloc");
        return p;
 }



--- End Message ---
--- Begin Message --- Subject: Re: bug#17499: current dfa.c can malloc 0 bytes Date: Thu, 15 May 2014 12:44:25 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
On 05/15/2014 10:34 AM, Aharon Robbins wrote:
The wrapper only checks for NULL return.

Ah, thanks, that's the problem then: gawk's xmalloc is pickier than grep's, and the extra pickiness is incompatible with what dfa.c expects. I see that gawk's xrealloc is also too picky, but gawk's xcalloc is OK. Attached isa patch to gawk. As this problem does not affect grep I'll close the grep bug.


Attachment: 0001-Port-to-systems-where-malloc-0-and-or-realloc-P-0-re.patch
Description: Text Data


--- End Message ---

reply via email to

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