Clear UBsan finding with -std=c++03

New finding after cutting in ChaCha20/Poly1305
pull/795/head
Jeffrey Walton 2019-01-30 07:28:08 -05:00
parent b69bfb5bdf
commit 02f5da3511
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 8 additions and 0 deletions

View File

@ -10,10 +10,18 @@ NAMESPACE_BEGIN(CryptoPP)
void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_t len)
{
// UBsan finding with -std=c++03 using memcpy
CRYPTOPP_ASSERT(input && len);
if(!input || !len) return;
unsigned int blockSize = AuthenticationBlockSize();
unsigned int &num = m_bufferedDataLength;
byte* data = m_buffer.begin();
// UBsan finding with -std=c++03 using memcpy
CRYPTOPP_ASSERT(data);
if(!data) return;
if (num != 0) // process left over data
{
if (num+len >= blockSize)