From 87223540e63f6da7ea085c1379deacc23b6ba5dc Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 7 Dec 2017 09:16:25 +0000 Subject: Some more overflow checks --- src/debug.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/debug.h') diff --git a/src/debug.h b/src/debug.h index 69b0a7c..e58c1d5 100644 --- a/src/debug.h +++ b/src/debug.h @@ -25,6 +25,10 @@ bool is_quiet_mode(); bool is_issue(uint issue); bool is_legacy_mode(); +#define check_int_mult_overflow(m,n) \ + { auto x = m * n; \ + enforce_msg(x / m == n, "multiply integer overflow"); } + gsl_matrix *gsl_matrix_safe_alloc(size_t rows,size_t cols); int gsl_matrix_safe_memcpy (gsl_matrix *dest, const gsl_matrix *src); void gsl_matrix_safe_free (gsl_matrix *v); -- cgit v1.2.3