diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-08-09 17:20:23 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-08-10 11:58:17 -0400 |
commit | 70a55c059b014c7a687de7a4813a90c65148aed4 (patch) | |
tree | bb7a9565d8bcad26a6c232cc0f1f3a946812bc1c /src/psbt.h | |
parent | ac59112a6a093e641ce2803260dd9de97b1cd961 (diff) |
psbt: Avoid unsigned int overflow in PSBT_IN_TAP_BIP32_DERIVATION
Diffstat (limited to 'src/psbt.h')
-rw-r--r-- | src/psbt.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/psbt.h b/src/psbt.h index eef7d7dd3b..d5c67802c7 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -641,6 +641,9 @@ struct PSBTInput s >> leaf_hashes; size_t after_hashes = s.size(); size_t hashes_len = before_hashes - after_hashes; + if (hashes_len > value_len) { + throw std::ios_base::failure("Input Taproot BIP32 keypath has an invalid length"); + } size_t origin_len = value_len - hashes_len; m_tap_bip32_paths.emplace(xonly, std::make_pair(leaf_hashes, DeserializeKeyOrigin(s, origin_len))); break; |