Add additional assert to FixedSizeAllocatorWithCleanup (GH #745)
This assert checks the array we return to the caller is large enough. Spoiler alert... it is not always large enough, like on 64-bit AIX. The linker on AIX appears to align smaller than 8-bytespull/748/head
parent
1e8ac49b49
commit
6cf8895bf1
|
|
@ -500,7 +500,10 @@ private:
|
|||
// for a large T, and that is what PAD achieves.
|
||||
T* GetAlignedArray() {
|
||||
T* p_array = (T*)(void*)(((byte*)m_array) + (0-(size_t)m_array)%16);
|
||||
// Verify the 16-byte alignment
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(p_array, 16));
|
||||
// Verify allocated array with pad is large enough.
|
||||
CRYPTOPP_ASSERT(p_array+S <= m_array+(S+PAD));
|
||||
return p_array;
|
||||
}
|
||||
// PAD is elements, not bytes, and rounded up to ensure no overflow.
|
||||
|
|
|
|||
Loading…
Reference in New Issue