[BugFix]: Do not allow deserializing PSBT with empty PSBT_OUT_TAP_TREE

Github-Pull: #25858
Rebased-From: 0652dc53b291bd295caff4093ec2854fd4b34645
This commit is contained in:
Jeremy Rubin 2022-08-16 12:09:27 -07:00 committed by fanquake
parent 9b438f06ec
commit 1390c96c8e
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -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;