summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>2018-08-25 13:36:20 +0000
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>2018-08-25 13:36:20 +0000
commit9e558a1cfc4ca7bfa53e5744348a84d0516a7551 (patch)
treef32949f3f91e1bbf353490b3f2d6259bfe35672d
parent0c22a1324ecfa996657dd31931dd34774ee85977 (diff)
downloadlibapr-9e558a1cfc4ca7bfa53e5744348a84d0516a7551.tar.gz
* 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: http://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1839050 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--test/teststr.c2
1 files changed, 1 insertions, 1 deletions
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);