From 8afc0e5cc559a08d2beae7fe4d9ba5d1c850b4f7 Mon Sep 17 00:00:00 2001 From: Bruno Levy Date: Thu, 26 Oct 2023 10:21:48 +0200 Subject: [PATCH] Check expansion length for allocation on stack only of GEO_BIG_STACK is not defined. --- src/lib/geogram/numerics/multi_precision.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/geogram/numerics/multi_precision.h b/src/lib/geogram/numerics/multi_precision.h index 1802a535ed60..200e051053e3 100644 --- a/src/lib/geogram/numerics/multi_precision.h +++ b/src/lib/geogram/numerics/multi_precision.h @@ -291,13 +291,15 @@ namespace GEO { * \brief Computes the amount of memory required to store * an expansion on the stack * \details Behaves like bytes() but in debug mode checks - * that this will fit on the stack + * that this will fit on the stack. * \param[in] capa the required capacity * \return the total number of bytes required to store * an expansion of capacity \p capa. */ static size_t bytes_on_stack(index_t capa) { +#ifndef GEO_HAS_BIG_STACK geo_debug_assert(capa < MAX_CAPACITY_ON_STACK); +#endif return bytes(capa); }