Cleared UBsan warnings under GCC 5.1
parent
3a08e02f71
commit
427e1cf028
12
iterhash.cpp
12
iterhash.cpp
|
|
@ -27,7 +27,9 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
{
|
{
|
||||||
if (num+len >= blockSize)
|
if (num+len >= blockSize)
|
||||||
{
|
{
|
||||||
memcpy(data+num, input, blockSize-num);
|
if(data && input)
|
||||||
|
memcpy(data+num, input, blockSize-num);
|
||||||
|
|
||||||
HashBlock(dataBuf);
|
HashBlock(dataBuf);
|
||||||
input += (blockSize-num);
|
input += (blockSize-num);
|
||||||
len -= (blockSize-num);
|
len -= (blockSize-num);
|
||||||
|
|
@ -36,7 +38,9 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(data+num, input, len);
|
if(data && input)
|
||||||
|
memcpy(data+num, input, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +63,9 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
{ // copy input first if it's not aligned correctly
|
{ // copy input first if it's not aligned correctly
|
||||||
memcpy(data, input, blockSize);
|
if(data && input)
|
||||||
|
memcpy(data, input, blockSize);
|
||||||
|
|
||||||
HashBlock(dataBuf);
|
HashBlock(dataBuf);
|
||||||
input+=blockSize;
|
input+=blockSize;
|
||||||
len-=blockSize;
|
len-=blockSize;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue