aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Rubin <j@rubin.io>2022-08-16 12:09:27 -0700
committerfanquake <fanquake@gmail.com>2022-10-13 23:43:29 +0800
commit1390c96c8e9c56e0d8348ef056f18e3e04f0f63f (patch)
tree6fd4822bc1219a008e75a124af7da5ed38a61693
parent9b438f06ecfc3fb21d2c5219b71fb4aa77875b8c (diff)
downloadbitcoin-1390c96c8e9c56e0d8348ef056f18e3e04f0f63f.tar.xz
[BugFix]: Do not allow deserializing PSBT with empty PSBT_OUT_TAP_TREE
Github-Pull: #25858 Rebased-From: 0652dc53b291bd295caff4093ec2854fd4b34645
-rw-r--r--src/psbt.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/psbt.h b/src/psbt.h
index d5c67802c7..b8c35c9970 100644
--- a/src/psbt.h
+++ b/src/psbt.h
@@ -862,6 +862,9 @@ struct PSBTOutput
std::vector<unsigned char> tree_v;
s >> tree_v;
SpanReader s_tree(s.GetType(), s.GetVersion(), tree_v);
+ if (s_tree.empty()) {
+ throw std::ios_base::failure("Output Taproot tree must not be empty");
+ }
while (!s_tree.empty()) {
uint8_t depth;
uint8_t leaf_ver;