Zcoin implementation bug enabled attacker to create 548, 000 Zcoins
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 7 07:05:45 PST 2017
Walter Bright wrote:
> https://makebitcoingreatagain.wordpress.com/2017/02/18/is-the-zcoin-bug-in-checktransaction/#update6
>
> The error is here:
>
> https://github.com/zcoinofficial/zcoin/blob/81a667867b5d8489...
>
> and the line of code:
>
> zccoinSpend.denomination == libzerocoin::ZQ_LOVELACE;
>
> In other words, a statement with no effect. In D, such a line gives an
> error, not a warning:
>
> Error: == has no effect in expression
only for primitive types, sadly.
void main () {
Object a, b;
a == b;
}
oops. no more error messages. yes, i know that this invokes `opEquals()`,
and `opEquals()` can have side-effects. but what are the chances of writing
such code *intentionally*?
i guess, compiler should emit error for *any* usage of "==" without using
the result, even if it lowers to `opEquals()` or something. and if one
really want to use it and drop it's result, there is always escape path:
cast(void)(a == b);
More information about the Digitalmars-d
mailing list