[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] Fix test in case of canaries on heap buffer after free
From: |
roucaries . bastien |
Subject: |
[PATCH 1/6] Fix test in case of canaries on heap buffer after free |
Date: |
Mon, 13 Apr 2020 01:09:13 +0200 |
From: Bastien Roucariès <address@hidden>
Some implementation could add canaries after free failling the test
Signed-off-by: Bastien Roucariès <address@hidden>
---
tests/test-explicit_bzero.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c
index 526ccfd48..54eb08b26 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 (SECRET, heapbuf, SECRET_SIZE) != 0);
printf ("test_heap: address range is still mapped after free().\n");
}
else
--
2.25.1
- [V3][0/6] explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 1/6] Fix test in case of canaries on heap buffer after free,
roucaries . bastien <=
- [PATCH 2/6] Use memset_s if possible for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 3/6] Use SecureZeroMemory on windows for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 4/6] Support clang for explicit_bzero, roucaries . bastien, 2020/04/12
- [PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile pointer, roucaries . bastien, 2020/04/12
- [PATCH 6/6] Improve styling in explicit_bzero, roucaries . bastien, 2020/04/12