diff options
author | Jeffrey Walton <noloader@gmail.com> | 2016-09-16 11:27:15 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2016-09-16 11:27:15 -0400 |
commit | 399a1546de71f41598c15edada28e7f0d616f541 (patch) | |
tree | 530160789358a3303be180df2d8529c82782156b /basecode.cpp | |
parent | fca5fbb36169a7522e6c533df9c322d47e3dc6bb (diff) | |
download | cryptopp-git-399a1546de71f41598c15edada28e7f0d616f541.tar.gz |
Add CRYPTOPP_ASSERT (Issue 277, CVE-2016-7420)
trap.h and CRYPTOPP_ASSERT has existed for over a year in Master. We deferred on the cut-over waiting for a minor version bump (5.7). We have to use it now due to CVE-2016-7420
Diffstat (limited to 'basecode.cpp')
-rw-r--r-- | basecode.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/basecode.cpp b/basecode.cpp index e4806466..954d11cb 100644 --- a/basecode.cpp +++ b/basecode.cpp @@ -57,7 +57,7 @@ size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, boo unsigned int b = begin[m_inputPosition++], bitsLeftInSource = 8;
while (true)
{
- assert(m_bitsPerChar-m_bitPos >= 0);
+ CRYPTOPP_ASSERT(m_bitsPerChar-m_bitPos >= 0);
unsigned int bitsLeftInTarget = (unsigned int)(m_bitsPerChar-m_bitPos);
m_outBuf[m_bytePos] |= b >> (8-bitsLeftInTarget);
if (bitsLeftInSource >= bitsLeftInTarget)
@@ -78,13 +78,13 @@ size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, boo }
}
- assert(m_bytePos <= m_outputBlockSize);
+ CRYPTOPP_ASSERT(m_bytePos <= m_outputBlockSize);
if (m_bytePos == m_outputBlockSize)
{
int i;
for (i=0; i<m_bytePos; i++)
{
- assert(m_outBuf[i] < (1 << m_bitsPerChar));
+ CRYPTOPP_ASSERT(m_outBuf[i] < (1 << m_bitsPerChar));
m_outBuf[i] = m_alphabet[m_outBuf[i]];
}
FILTER_OUTPUT(1, m_outBuf, m_outputBlockSize, 0);
@@ -183,14 +183,14 @@ void BaseN_Decoder::InitializeDecodingLookupArray(int *lookup, const byte *alpha {
if (caseInsensitive && isalpha(alphabet[i]))
{
- assert(lookup[toupper(alphabet[i])] == -1);
+ CRYPTOPP_ASSERT(lookup[toupper(alphabet[i])] == -1);
lookup[toupper(alphabet[i])] = i;
- assert(lookup[tolower(alphabet[i])] == -1);
+ CRYPTOPP_ASSERT(lookup[tolower(alphabet[i])] == -1);
lookup[tolower(alphabet[i])] = i;
}
else
{
- assert(lookup[alphabet[i]] == -1);
+ CRYPTOPP_ASSERT(lookup[alphabet[i]] == -1);
lookup[alphabet[i]] = i;
}
}
|