Skip to content

Commit f7826f9

Browse files
committed
psbt: avoid assigning non-boolean values to bool (ubsan)
ubsan doesn't like assigning arbitrary uint8_t values to bool. It's easy to avoid doing, so do it. (We do this specifically in PSET since that's Elements-specific code, but the same issue is present in Bitcoin in the Unserialize impl for bool in serialize.h. Upstream this is only used in the wallet database, where it may be that non 0/1 values are impossible (absent a corrupt wallet).
1 parent 0397d22 commit f7826f9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/psbt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,9 @@ struct PSBTInput
10911091
} else if (subkey_len != 1) {
10921092
throw std::ios_base::failure("Input issuance needs blinded flag is more than one byte type");
10931093
}
1094-
bool b;
1094+
uint8_t b;
10951095
UnserializeFromVector(s, b);
1096-
m_blinded_issuance = b;
1096+
m_blinded_issuance = !!b;
10971097
break;
10981098
}
10991099
default:

0 commit comments

Comments
 (0)