]> Savannah Git Hosting - gnulib.git/commitdiff
explicit_bzero tests: Fix test failure on OpenBSD 6.5.
authorBastien Roucariès <rouca@debian.org>
Sun, 12 Apr 2020 23:09:13 +0000 (01:09 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 13 Apr 2020 21:58:34 +0000 (23:58 +0200)
Some implementation could add canaries after free failling the test.

* tests/test-explicit_bzero.c (test_heap): Handle implementations of
free() that overwrite the memory with canaries.

Signed-off-by: Bastien Roucariès <rouca@debian.org>
ChangeLog
tests/test-explicit_bzero.c

index a107fd5b647d4ae4a82f2ae40077f6aa782ee74d..90fb56312355ceede1ee2fc44677b6f9214d839a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-13  Bastien Roucariès  <rouca@debian.org>
+
+       explicit_bzero tests: Fix test failure on OpenBSD 6.5.
+       * tests/test-explicit_bzero.c (test_heap): Handle implementations of
+       free() that overwrite the memory with canaries.
+
 2020-04-13  Akim Demaille  <akim@lrde.epita.fr>
 
        bootstrap: recommend git submodule update --init
index 526ccfd48d52e21e7fbc2ba83d0aeaa1b8ec6b35..5abc0042160679b08fb21ede603298386d4a8def 100644 (file)
@@ -112,7 +112,9 @@ test_heap (void)
   free (heapbuf);
   if (is_range_mapped (addr, addr + SECRET_SIZE))
     {
-      ASSERT (memcmp (zero, heapbuf, SECRET_SIZE) == 0);
+      /* some implementation could override freed memory by canaries so
+         compare against secret */
+      ASSERT (memcmp (heapbuf, SECRET, SECRET_SIZE) != 0);
       printf ("test_heap: address range is still mapped after free().\n");
     }
   else