GNU bug report logs - #17499
current dfa.c can malloc 0 bytes

Previous Next

Package: grep;

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Aharon Robbins <arnold <at> skeeve.com>, 17499 <at> debbugs.gnu.org
Subject: bug#17499: current dfa.c can malloc 0 bytes
Date: Thu, 15 May 2014 09:48:41 -0700
On 05/15/2014 09:22 AM, Aharon Robbins wrote:
> 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.

Thanks, I'll try to take a look at this from your recipe.  Are there any 
more details about the failure? What are the symptoms?

A quick look at the dfa.c source code in grep suggests that it can't be 
a direct call to xmalloc, as those args all must be nonzero.  Perhaps 
it's indirect, via xnmalloc or something like that?

Also, gnulib's xmalloc doesn't mind if malloc (0) returns NULL. Is 
gawk's xmalloc pickier?  If so, why?




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.