diff options
author | Rainer Jung <rjung@apache.org> | 2018-08-25 13:36:20 +0000 |
---|---|---|
committer | Rainer Jung <rjung@apache.org> | 2018-08-25 13:36:20 +0000 |
commit | 09ffde105095ce26edc9c6a66c9888ddcd0ddcf3 (patch) | |
tree | f32949f3f91e1bbf353490b3f2d6259bfe35672d | |
parent | 7db2a0db37d245a880568966089b702fc355ab72 (diff) | |
download | apr-09ffde105095ce26edc9c6a66c9888ddcd0ddcf3.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: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1839050 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/teststr.c | 2 |
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); |