[Bug regex/16851] re_node_set_alloc should not return REG_ESPACE when size == 0
eggert at cs dot ucla.edu
sourceware-bugzilla@sourceware.org
Fri Jun 29 15:04:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=16851
eggert at cs dot ucla.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eggert at cs dot ucla.edu
--- Comment #6 from eggert at cs dot ucla.edu ---
(In reply to Adhemerval Zanella from comment #4)
> Paul, I am planning to sync gnulib regex with glibc, and glibc support
> malloc interposition. Do we need to handle this case?
We don't *need* to handle this case, since POSIX and the C standard prohibit
malloc interposition in conforming programs, glibc has every right to insist on
its own rules when it supports malloc interposition as an extension, and one of
those rules can be "malloc (0) must return nonnull on success".
That being said, it would be easy to add support for
interposed-malloc-0-returning-NULL to the regex code by doing as Nathan Kennedy
suggests at the top of bug 16851. Although this would add an extra pair of
instructions, these instructions would be executed only in a cold path so there
should be little runtime overhead.
On the other hand, I expect that there are several other places in glibc that
break if an interposed malloc (0) returns NULL on success. Do we really want to
audit glibc and "fix" every instance? Wouldn't it be better just to document
that interposed malloc must behave in a certain way? I'm not sure we should
make glibc a bit bigger and slower simply to cater to malloc interposers that
don't conform to glibc's API.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list