summaryrefslogtreecommitdiff
path: root/secblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'secblock.h')
-rw-r--r--secblock.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/secblock.h b/secblock.h
index a9e350a6..4ad7c381 100644
--- a/secblock.h
+++ b/secblock.h
@@ -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.