From: Bastien Roucariès Date: Sun, 12 Apr 2020 23:09:13 +0000 (+0200) Subject: explicit_bzero tests: Fix test failure on OpenBSD 6.5. X-Git-Tag: v1.0~4168 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6624b766b2871c9e5ecf6400dd56cb5e5c441558;p=gnulib.git explicit_bzero tests: Fix test failure on OpenBSD 6.5. 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 --- diff --git a/ChangeLog b/ChangeLog index a107fd5b64..90fb563123 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-04-13 Bastien Roucariès + + 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 bootstrap: recommend git submodule update --init diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 526ccfd48d..5abc004216 100644 --- a/tests/test-explicit_bzero.c +++ b/tests/test-explicit_bzero.c @@ -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