Skip to content

Commit

Permalink
fix: reading unitialized memory from Util::HasOnlyZeros in G2Element …
Browse files Browse the repository at this point in the history
…deserialization
  • Loading branch information
knst committed May 16, 2023
1 parent 3697c51 commit 03745f7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 03745f7

Please sign in to comment.