Using SMT Solvers to Analyze the Premier League Table
spramod.info56 ポイント投稿者 microarchitect4 コメント
if( ((RAM[ACC] & 0xF0) >> 4) > 9 ||
GetBit(RAM[PSW], CY) == 0x01 ) {
tempAdd = RAM[ACC] + 0x60;
RAM[ACC] = tempAdd;
if( ((unsigned char*)&tempAdd)[1] != 0 ) {
SetBit(RAM[PSW], CY);
}
}
The code is supposed to set the carry flag when RAM[ACC] + 0x60 overflows into two bytes. Can you spot the bug? It involves my favorite C++ feature: implicit conversions, and my second favorite feature: signed chars.
PS. This is not a theoretical statement. It has happened to numerous altcoins.
PPS. In case it needs spelling out, the fact that its too expensive to attack the blockchain means that it is even more expensive to secure it (because miners need to make a profit).