glibc/manual
Dennis Wölfing 2e0bbbfbf9 Add reallocarray function
The reallocarray function is an extension from OpenBSD.  It is an
integer-overflow-safe replacement for realloc(p, X*Y) and
malloc(X*Y) (realloc(NULL, X*Y)).  It can therefore help in preventing
certain security issues in code.

This is an updated version of a patch originally submitted by Rüdiger
Sonderfeld in May 2014 [1].

Checked on i686-linux-gnu and x86_64-linux-gnu.

[1] <https://sourceware.org/ml/libc-alpha/2014-05/msg00481.html>.

2017-05-30  Dennis Wölfing  <denniswoelfing@gmx.de>
            Rüdiger Sonderfeld  <ruediger@c-plusplus.de>

	* include/stdlib.h (__libc_reallocarray): New declaration.
	* malloc/Makefile (routines): Add reallocarray.
	(tests): Add tst-reallocarray.c.
	* malloc/Versions: Add reallocarray and __libc_reallocarray.
	* malloc/malloc-internal.h (check_mul_overflow_size_t): New inline
	function.
	* malloc/malloc.h (reallocarray): New declaration.
	* stdlib/stdlib.h (reallocarray): Likewise.
	* malloc/reallocarray.c: New file.
	* malloc/tst-reallocarray.c: New test file.
	* manual/memory.texi: Document reallocarray.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add reallocarray.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
2017-05-30 18:27:57 -03:00
..
examples Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
argp.texi Manual typos: The Basic Program/System Interface 2016-10-06 12:19:25 +05:30
arith.texi Add fromfp functions. 2016-12-31 00:40:59 +00:00
charset.texi
check-safety.sh Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
conf.texi manual: Convert @tables of annotated @items to @vtables. 2017-05-18 00:44:06 -07:00
contrib.texi Fix a typo in the manual. 2017-02-08 01:34:12 -08:00
creature.texi Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__ 2017-05-09 11:40:28 -03:00
crypt.texi manual: Fix up invalid header and standards syntax. 2017-05-18 00:39:48 -07:00
ctype.texi
debug.texi Manual typos: Debugging support 2016-10-06 12:25:38 +05:30
dir
errno.texi manual: Convert errno @comments to new @errno macro. 2017-05-19 22:47:53 -07:00
fdl-1.3.texi
filesys.texi manual: Fix up invalid header and standards syntax. 2017-05-18 00:39:48 -07:00
freemanuals.texi
getopt.texi getopt: remove USE_NONOPTION_FLAGS 2017-04-07 07:45:53 -04:00
header.texi
install-plain.texi
install.texi Assume that accept4 is always available and works 2017-04-19 07:44:48 +02:00
intro.texi
io.texi
ipc.texi
job.texi Manual typos: Job Control 2016-10-06 12:20:28 +05:30
lang.texi manual: Convert @tables of annotated @items to @vtables. 2017-05-18 00:44:06 -07:00
lgpl-2.1.texi
libc-texinfo.sh
libc.texinfo Update copyright dates not handled by scripts/update-copyrights. 2017-01-01 00:26:24 +00:00
libcbook.texi
libdl.texi
libm-err-tab.pl Do not hardcode list of libm functions in libm-err-tab.pl. 2017-02-06 17:55:59 +00:00
llio.texi manual: Add preadv and pwritev documentation 2017-05-04 17:44:12 -03:00
locale.texi manual: Fix up invalid header and standards syntax. 2017-05-18 00:39:48 -07:00
macros.texi manual: Convert errno @comments to new @errno macro. 2017-05-19 22:47:53 -07:00
maint.texi Manual typos: Library Maintenance 2016-10-06 12:29:11 +05:30
Makefile Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
math.texi Do not hardcode list of libm functions in libm-err-tab.pl. 2017-02-06 17:55:59 +00:00
memory.texi Add reallocarray function 2017-05-30 18:27:57 -03:00
message.texi
nss.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
nsswitch.texi
pattern.texi manual: Convert @tables of annotated @items to @vtables. 2017-05-18 00:44:06 -07:00
pipe.texi
platform.texi
probes.texi User manual documentation for tunables 2016-12-31 23:49:24 +05:30
process.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
resource.texi manual: Convert @tables of annotated @items to @vtables. 2017-05-18 00:44:06 -07:00
search.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
setjmp.texi Manual typos: Non-Local Exits 2016-10-06 12:17:29 +05:30
signal.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
socket.texi manual: Convert @tables of annotated @items to @vtables. 2017-05-18 00:44:06 -07:00
startup.texi Manual typos: The Basic Program/System Interface 2016-10-06 12:19:25 +05:30
stdio-fp.c
stdio.texi libio: Avoid dup already opened file descriptor [BZ#21393] 2017-05-22 18:13:35 -03:00
string.texi New string function explicit_bzero (from OpenBSD). 2016-12-16 16:21:54 -05:00
summary.awk Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
sysinfo.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
syslog.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
terminal.texi manual: Convert @tables of variables to @vtables. 2016-12-21 01:36:58 -08:00
texinfo.tex Update miscellaneous files from upstream sources. 2016-12-21 16:05:55 +00:00
texis.awk
threads.texi Manual typos: POSIX Threads 2016-10-06 12:26:06 +05:30
time.texi manual: Fix up invalid header and standards syntax. 2017-05-18 00:39:48 -07:00
tsort.awk Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
tunables.texi User manual documentation for tunables 2016-12-31 23:49:24 +05:30
users.texi manual: Fix up invalid header and standards syntax. 2017-05-18 00:39:48 -07:00
xtract-typefun.awk