1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:17:35 +00:00

LibCrypto: Remove redundant __builtin_memset() call

This call caused GCC 12's static analyzer to think that we perform an
out-of-bounds write to the v_key Vector. This is obviously incorrect,
and comes from the fact that GCC doesn't properly track whether we use
the inline storage, or the Vector is allocated on the heap.

While searching for a workaround, Sam pointed out that this call is
redundant as `Vector::resize()` already zeroes out the elements, so we
can completely remove it.

Co-authored-by: Sam Atkins <atkinssj@serenityos.org>
This commit is contained in:
Daniel Bertalan 2021-12-24 12:10:29 +01:00 committed by Brian Gianforcaro
parent 2b1864c53a
commit a2aae6a582

View file

@ -85,7 +85,6 @@ private:
// Note: The block size of all the current hash functions is 512 bits.
Vector<u8, 64> v_key;
v_key.resize(block_size);
__builtin_memset(v_key.data(), 0, block_size);
auto key_buffer = v_key.span();
// m_key_data is zero'd, so copying the data in
// the first few bytes leaves the rest zero, which