Clear UBsan finding with -std=c++03

New finding after cutting in ChaCha20/Poly1305
pull/795/head
Jeffrey Walton 2019-01-30 09:56:36 -05:00
parent 02f5da3511
commit 33897e944c
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 2 additions and 5 deletions

View File

@ -18,10 +18,6 @@ void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_
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)
@ -49,7 +45,8 @@ void AuthenticatedSymmetricCipherBase::AuthenticateData(const byte *input, size_
len = leftOver;
}
memcpy(data, input, len);
if (data)
memcpy(data, input, len);
num = (unsigned int)len;
}