From 068e9b2eb4d2b50e84c8e0debf38e8ee0b955307 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 15 Aug 2021 16:13:15 +0930 Subject: Fix malloc overflow check warning To fix this warning: ../src/cairo-malloc-private.h:83:32: warning: comparison is always false due to limited range of data type [-Wtype-limits] 83 | ((size) != 0 && (size_t) (a) >= SIZE_MAX / (size_t) (size) ? NULL : \ | ^~ Create two new macros to do the overflow checks: _cairo_addl_size_t_overflow and _cairo_mul_size_t_overflow. Implement them using compiler builtins where available. Update cairo-malloc-private to use these fuctions and add an overflow test to test the functions. --- meson.build | 1 + 1 file changed, 1 insertion(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index f10a0067b..7a0506712 100644 --- a/meson.build +++ b/meson.build @@ -151,6 +151,7 @@ check_headers = [ ['fenv.h', {'check-funcs': ['feenableexcept', 'fedisableexcept', 'feclearexcept']}], ['xlocale.h'], ['sys/ioctl.h'], + ['intsafe.h'], ] check_types = [ -- cgit v1.2.1