瀏覽代碼

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>
Daniel Bertalan 3 年之前
父節點
當前提交
a2aae6a582
共有 1 個文件被更改,包括 0 次插入1 次删除
  1. 0 1
      Userland/Libraries/LibCrypto/Authentication/HMAC.h

+ 0 - 1
Userland/Libraries/LibCrypto/Authentication/HMAC.h

@@ -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