public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [Bitcoin-development] Malleable booleans
@ 2014-10-14  2:34 Pieter Wuille
  2014-10-14  2:45 ` Gregory Maxwell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pieter Wuille @ 2014-10-14  2:34 UTC (permalink / raw)
  To: Bitcoin Dev

Hi all,

while working on a BIP62 implementation I discovered yet another type
of malleability: the interpretation of booleans.

Any byte array with non-zero bytes in it (ignoring the highest bit of
the last byte, which is the sign bit when interpreting as a number) is
interpreted as true, anything else as false. Other than numbers,
they're not even restricted to 4 bytes. Worse, the code for dealing
with booleans is not very consistent: OP_BOOLAND and OP_BOOLOR first
interpret their arguments as numbers, and then compare them to 0 to
turn them into boolean values.

This means that scripts that use booleans as inputs will be inherently
malleable. Given that that seems actually useful (passing in booleans
to guide some OP_IF's during execution of several alternatives), I
would like to change BIP62 to also state that interpreted booleans
must be of minimal encoded size (in addition to numbers).

Any opinions for or against?



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-14 19:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14  2:34 [Bitcoin-development] Malleable booleans Pieter Wuille
2014-10-14  2:45 ` Gregory Maxwell
2014-10-14  7:27 ` Thomas Zander
2014-10-14  7:52   ` Gregory Maxwell
2014-10-14  8:04   ` Wladimir
2014-10-14  8:09 ` Peter Todd
2014-10-14 18:54   ` Pieter Wuille
2014-10-14 19:45     ` Peter Todd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox