Skip to content

Commit f60e97d

Browse files
committed
Unpoison GetPubKey output for MSan
secp256k1_ec_pubkey_serialize fills the CPubKey buffer from libsecp, which runs without MemorySanitizer instrumentation. Mark the entire buffer initialized so downstream Schnorr/XOnly conversions do not trip MSan during the roundtrip handshake test. Test: cmake --build build --target test_sv2 --config Release Assisted-by: GitHub Copilot Assisted-by: OpenAI GPT-5-Codex
1 parent a8a230a commit f60e97d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/key.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ CPubKey CKey::GetPubKey() const {
193193
secp256k1_ec_pubkey_serialize(secp256k1_context_sign, (unsigned char*)result.begin(), &clen, &pubkey, fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
194194
assert(result.size() == clen);
195195
assert(result.IsValid());
196+
#ifdef MEMORY_SANITIZER
197+
__msan_unpoison(result.data(), CPubKey::SIZE);
198+
#endif
196199
return result;
197200
}
198201

0 commit comments

Comments
 (0)