From 90fc0a3f67d93d9900f77e4374166b7967738cf5 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 16 May 2023 16:53:22 +0700 Subject: [PATCH] fix: reading unitialized memory from Util::HasOnlyZeros in G2Element deserialization --- src/elements.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/elements.cpp b/src/elements.cpp index ef30667d5..278af8cd8 100644 --- a/src/elements.cpp +++ b/src/elements.cpp @@ -254,6 +254,7 @@ G2Element G2Element::FromBytesUnchecked(Bytes const bytes, const bool fLegacy) if (fLegacy) { std::memcpy(buffer + 1, bytes.begin(), G2Element::SIZE); + buffer[0] = 0x00; } else { std::memcpy(buffer + 1, bytes.begin() + G2Element::SIZE / 2, G2Element::SIZE / 2); std::memcpy(buffer + 1 + G2Element::SIZE / 2, bytes.begin(), G2Element::SIZE / 2);