You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2018/06/06 07:16:48 UTC

svn commit: r1832985 - /apr/apr/trunk/test/teststr.c

Author: jorton
Date: Wed Jun  6 07:16:48 2018
New Revision: 1832985

URL: http://svn.apache.org/viewvc?rev=1832985&view=rev
Log:
* 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).

Modified:
    apr/apr/trunk/test/teststr.c

Modified: apr/apr/trunk/test/teststr.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/teststr.c?rev=1832985&r1=1832984&r2=1832985&view=diff
==============================================================================
--- apr/apr/trunk/test/teststr.c (original)
+++ apr/apr/trunk/test/teststr.c Wed Jun  6 07:16:48 2018
@@ -307,7 +307,7 @@ static void overflow_strfsize(abts_case
     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);