diff options
author | Aurèle Oulès <aurele@oules.com> | 2022-07-25 18:45:43 +0200 |
---|---|---|
committer | Aurèle Oulès <aurele@oules.com> | 2022-07-25 18:45:57 +0200 |
commit | 4fa79837ad19fada3a3df3fb490617f6ca4606e0 (patch) | |
tree | de657a172af51fcf63b7e2f6ec506dbcf315d173 /src/psbt.h | |
parent | 5057adf22fc4c3593e1e633defeda96be508f198 (diff) |
psbt: Fix unsigned integer overflow
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 c390bb67d3..eef7d7dd3b 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -893,6 +893,9 @@ struct PSBTOutput 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("Output 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; |