diff -ur apr-1.6.3.orig/test/teststr.c apr-1.6.3/test/teststr.c --- apr-1.6.3.orig/test/teststr.c 2016-03-03 17:11:16.000000000 +0100 +++ apr-1.6.3/test/teststr.c 2018-01-29 18:54:44.748931098 +0100 @@ -307,10 +307,15 @@ for (; off < 999999999; off += 999) { apr_strfsize(off, buf); } - for (off = 1; off < LONG_MAX && off > 0; off *= 2) { + + off = 1; + while (1) { apr_strfsize(off, buf); apr_strfsize(off + 1, buf); apr_strfsize(off - 1, buf); + if (off > LONG_MAX / 2) + break; + off *= 2; } ABTS_ASSERT(tc, "strfsize overflowed", buf[5] == '$');