Skip to content

Commit

Permalink
Check expansion length for allocation on stack only of GEO_BIG_STACK
Browse files Browse the repository at this point in the history
is not defined.
  • Loading branch information
BrunoLevy committed Oct 26, 2023
1 parent a5ef240 commit 8afc0e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/geogram/numerics/multi_precision.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 8afc0e5

Please sign in to comment.