GNU bug report logs -
#17499
current dfa.c can malloc 0 bytes
Previous Next
Reported by: Aharon Robbins <arnold <at> skeeve.com>
Date: Thu, 15 May 2014 16:24:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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;
}
This bug report was last modified 11 years and 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.