LibCrypto: memcmp() all bytes in UnsignedBigInteger::operator==

`length` is only the (trimmed) size of the word vector, so we have to
multiply it with the size of each element to ensure all bytes are
compared.

Fixes #5335.
This commit is contained in:
Linus Groh 2021-02-14 10:25:12 +01:00 committed by Andreas Kling
parent 781d29a337
commit 1c6fd749dc
Notes: sideshowbarker 2024-07-18 22:20:16 +09:00

View File

@ -281,7 +281,7 @@ bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const
if (length != other.trimmed_length())
return false;
return !__builtin_memcmp(m_words.data(), other.words().data(), length);
return !__builtin_memcmp(m_words.data(), other.words().data(), length * (BITS_IN_WORD / 8));
}
bool UnsignedBigInteger::operator!=(const UnsignedBigInteger& other) const