From 22c94fd916d13573ba5ace10ae3852e196c33ddf Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 11 Sep 2024 11:15:31 +1000 Subject: [PATCH] util: silence out-of-bounds read warning gcc -fanalyze complains because it doesn't know the __stop section is always greater than the __start section so it complains that we're eventually reading past our __start section. Let's silence that with a simple check. --- src/util-munit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util-munit.h b/src/util-munit.h index 26b111b..96691fb 100644 --- a/src/util-munit.h +++ b/src/util-munit.h @@ -52,7 +52,7 @@ */ #define foreach_test(t_) \ for (const struct test_function *t_ = &__start_test_functions_section; \ - t_ < &__stop_test_functions_section; \ + t_ < &__stop_test_functions_section && t < &__start_test_functions_section; \ t_++) typedef MunitResult (*munit_test_func_t)(const MunitParameter params[], void *user_data);