bug-grep
[Top][All Lists]
Advanced

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

bug#17499: current dfa.c can malloc 0 bytes


From: Aharon Robbins
Subject: bug#17499: 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;
 }





reply via email to

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