From 4ece1c842a08c11c1f84b95355801d41cd8435b1 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 3 Mar 2023 14:55:19 -0800 Subject: Add XtReallocArray() for overflow checking of multiplied args Uses reallocarray() if available, otherwise checks for overflow itself, if overflow is possible (i.e. in ILP32 & ILP64 environments, but not LP64 with 32-bit ints). Includes unit tests and XtMallocArray() helper macro. Signed-off-by: Alan Coopersmith --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e0dbaa4..1da5532 100644 --- a/configure.ac +++ b/configure.ac @@ -22,13 +22,18 @@ # # Initialize Autoconf -AC_PREREQ([2.60]) +AC_PREREQ([2.70]) AC_INIT([libXt], [1.2.1], [https://gitlab.freedesktop.org/xorg/lib/libXt/issues], [libXt]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) +# Set common system defines for POSIX extensions, such as _GNU_SOURCE +# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL) +# to avoid autoconf errors. +AC_USE_SYSTEM_EXTENSIONS + # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-xz]) @@ -53,6 +58,9 @@ XORG_WITH_PERL # Checks for header files. AC_CHECK_HEADER([alloca.h], AC_DEFINE(INCLUDE_ALLOCA_H, 1, [Define to 1 if Xalloca.h should include ])) +# Checks for library functions. +AC_CHECK_FUNCS([reallocarray]) + # Obtain compiler/linker options for dependencies PKG_CHECK_MODULES(XT, sm ice x11 xproto kbproto) -- cgit v1.2.3