diff options
author | Chris Robinson <[email protected]> | 2023-12-05 00:39:35 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-05 00:39:35 -0800 |
commit | bab3a1c9f517446f6175815f1e943b5035747fda (patch) | |
tree | f49ed8f2be71acc2be32be087e1572378276d3a0 | |
parent | 034327c3e778c31eb1d19cd661b460825a98037b (diff) |
Make sure the size is large enough for allocating a struct
-rw-r--r-- | common/pffft.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/pffft.cpp b/common/pffft.cpp index 71f71fa6..8e849cb4 100644 --- a/common/pffft.cpp +++ b/common/pffft.cpp @@ -1436,7 +1436,8 @@ PFFFT_Setup *pffft_new_setup(unsigned int N, pffft_transform_t transform) assert((N%(SIMD_SZ*SIMD_SZ)) == 0); const uint Ncvec = (transform == PFFFT_REAL ? N/2 : N)/SIMD_SZ; - const size_t storelen{offsetof(PFFFT_Setup, e[0]) + (2u*Ncvec * sizeof(v4sf))}; + const size_t storelen{std::max(sizeof(PFFFT_Setup), + offsetof(PFFFT_Setup, e[0]) + (2u*Ncvec * sizeof(v4sf)))}; void *store{al_calloc(MALLOC_V4SF_ALIGNMENT, storelen)}; if(!store) return nullptr; |