From 31b8d99ca61b900d6215404b4f7a0cf245bbd684 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Mon, 18 Oct 2021 21:49:09 +0100 Subject: [PATCH] test/func/memcpy: adjust test sizes --- src/test/func/memcpy/func-memcpy.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/func/memcpy/func-memcpy.cc b/src/test/func/memcpy/func-memcpy.cc index 1727d38..202b303 100644 --- a/src/test/func/memcpy/func-memcpy.cc +++ b/src/test/func/memcpy/func-memcpy.cc @@ -135,8 +135,13 @@ int main() // Skip the checks that expect bounds checks to fail when we are not the // malloc implementation. # if !defined(SNMALLOC_PASS_THROUGH) - // Some sizes to check for out-of-bounds access - std::initializer_list sizes = {16, 1024, 2 * 1024 * 1024}; + // Some sizes to check for out-of-bounds access. As we are only able to + // catch overflows past the end of the sizeclass-padded allocation, make + // sure we don't try to test on smaller allocations. + std::initializer_list sizes = {MIN_ALLOC_SIZE, 1024, 2 * 1024 * 1024}; + static_assert( + MIN_ALLOC_SIZE < 1024, + "Can't detect overflow except at sizeclass boundaries"); for (auto sz : sizes) { // Check in bounds