From 09ffde105095ce26edc9c6a66c9888ddcd0ddcf3 Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Sat, 25 Aug 2018 13:36:20 +0000 Subject: * test/teststr.c (overflow_strfsize): Iterate from LONG_MAX downwards, avoiding signed integer overflow (undefined behaviour which gcc 8.1 turns into a non-terminating loop). Backport of r1832985 from trunk resp. r1834496 from 1.7.x. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1839050 13f79535-47bb-0310-9956-ffa450edef68 --- test/teststr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/teststr.c b/test/teststr.c index d9a505475..951a83001 100644 --- a/test/teststr.c +++ b/test/teststr.c @@ -307,7 +307,7 @@ static void overflow_strfsize(abts_case *tc, void *data) for (; off < 999999999; off += 999) { apr_strfsize(off, buf); } - for (off = 1; off < LONG_MAX && off > 0; off *= 2) { + for (off = LONG_MAX; off > 1; off /= 2) { apr_strfsize(off, buf); apr_strfsize(off + 1, buf); apr_strfsize(off - 1, buf); -- cgit v1.2.1