From 51f322b74c6070fb295f577759b9a25228eb3a21 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 17 Nov 2020 10:38:12 +0000 Subject: [PATCH] tests: Add missing assertion to guard against infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the loop variable changed signedness, it’s now possible for there to be an infinite loop if `get_match_count()` returns an error. Guard against that. Signed-off-by: Philip Withnall Coverity CID: #1436405 --- glib/tests/regex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/glib/tests/regex.c b/glib/tests/regex.c index d86d32f9b..c57bd8cdc 100644 --- a/glib/tests/regex.c +++ b/glib/tests/regex.c @@ -1316,6 +1316,7 @@ test_match_all (gconstpointer d) g_assert (match_ok); match_count = g_match_info_get_match_count (match_info); + g_assert_cmpint (match_count, >=, 0); if (match_count != g_slist_length (data->expected)) {