LetItPlay / CryptoWizards-SmartContract

https://wizards.one
MIT License
6 stars 3 forks source link

random number generation: bug in improbable case #3

Closed GassaFM closed 6 years ago

GassaFM commented 6 years ago

https://github.com/LetItPlay/CryptoWizards-SmartContract/blob/928e6116ad1a66380e5fa4897d19514ee44948d8/wizContract.cpp#L188

This is a bug in handling the improbable case (still a bit probable for very small lengths though). The line declares a new variable instead of assigning to the existing one.

Note that some compiler options (like -Wshadow shadowing warnings for GCC) may prevent such bugs.

GassaFM commented 6 years ago

For what it's worth, this does happen for calls with length = 1.

opcheese commented 6 years ago

Thank you! I have no idea how I missed that.