summaryrefslogtreecommitdiff
path: root/secblock.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2020-12-24 14:37:52 -0500
committerJeffrey Walton <noloader@gmail.com>2020-12-24 14:37:52 -0500
commit82672378e5d68e0ccedaa324f98e643d5789f95d (patch)
tree23e8cc01bc5295a3f4503bdf6ba0ab40ffe13eb6 /secblock.h
parent0b70a5e733a96c56dafdc183cd35effddedac48a (diff)
downloadcryptopp-git-82672378e5d68e0ccedaa324f98e643d5789f95d.tar.gz
Update comments
Diffstat (limited to 'secblock.h')
-rw-r--r--secblock.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/secblock.h b/secblock.h
index b59c431e..d7546604 100644
--- a/secblock.h
+++ b/secblock.h
@@ -527,9 +527,16 @@ private:
int off = reinterpret_cast<uintptr_t>(m_array) % 8;
byte* ptr = reinterpret_cast<byte*>(m_array) + off;
- // Verify the 16-byte alignment
+ // Verify the 16-byte alignment. This is the point
+ // of these extra gyrations.
CRYPTOPP_ASSERT(IsAlignedOn(ptr, 16));
- // Verify allocated array with pad is large enough.
+ // Verify the lower bound. This is Issue 982/988.
+ CRYPTOPP_ASSERT(
+ reinterpret_cast<uintptr_t>(ptr >=
+ reinterpret_cast<uintptr_t>(m_array)
+ );
+ // Verify the upper bound. Allocated array with
+ // pad is large enough.
CRYPTOPP_ASSERT(
reinterpret_cast<uintptr_t>(ptr+S*sizeof(T)) <=
reinterpret_cast<uintptr_t>(m_array+(S+PAD))