[libiberty] does anyone use regex.c with REGEX_MALLOC?
Aldy Hernandez
aldyh@redhat.com
Sat Jul 23 10:33:00 GMT 2016
Hi guys!
I'm looking at libiberty's use of alloca() and trying to place some
bounded checks at alloca() call points.
Silly question, do we have any users of regex.c with REGEX_MALLOC set?
I don't see any #define for REGEX_MALLOC anywhere in binutils or gcc,
and it doesn't look like autoconf magic being set elsewhere.
The only reference I see to REGEX_MALLOC is in libiberty/regex.c:
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
use `alloca' instead of `malloc'. This is because using malloc in
re_search* or re_match* could cause memory leaks when C-g is used in
Emacs; also, malloc is slower and causes storage fragmentation. On
the other hand, malloc is more portable, and easier to debug.
Not that it matters, but I see that the emacs source has its own variant
of this file (emacs-24.5/src/regex.c). So it's not like emacs is using
libiberty or anything.
Another silly question, who are libiberty's consumers? GCC and
binutils/gdb? Or should I be looking at additional packages for answers?
If the REGEX_MALLOC mode in regex.c is unused, can I rip it out? I'd
like to replace it all with alloca with a malloc fallback.
Sorry for the newbie questions, but I don't think I've ever had the...
ahmmm.. privilege of playing in libiberty land :-).
Thanks.
Aldy
More information about the Gcc
mailing list