diff options
author | Antoine Poinsot <darosior@protonmail.com> | 2024-04-11 16:08:01 +0200 |
---|---|---|
committer | Antoine Poinsot <darosior@protonmail.com> | 2024-04-22 18:24:35 +0200 |
commit | 4d8d21320eba54571ff63931509cd515c3e20339 (patch) | |
tree | a897f365e249177b8e6c4ff24f2ca5e8fa1aa360 /src/script/sign.cpp | |
parent | bdb33ec51986570ea17406c83bad2c955ae23186 (diff) | |
download | bitcoin-4d8d21320eba54571ff63931509cd515c3e20339.tar.xz |
sign: don't assume we are parsing a sane Miniscript
The script provided for signature might be externally provided, for
instance by way of 'finalizepsbt'. Therefore the script might be
ill-crafted, so don't assume pubkeys are always 32 bytes.
Thanks to Niklas for finding this.
Diffstat (limited to 'src/script/sign.cpp')
-rw-r--r-- | src/script/sign.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp index be4b357568..22ac062a63 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -295,7 +295,7 @@ struct TapSatisfier: Satisfier<XOnlyPubKey> { //! Conversion from a raw xonly public key. template <typename I> std::optional<XOnlyPubKey> FromPKBytes(I first, I last) const { - CHECK_NONFATAL(last - first == 32); + if (last - first != 32) return {}; XOnlyPubKey pubkey; std::copy(first, last, pubkey.begin()); return pubkey; |