Add failing overflow test.#40
Conversation
|
@demonsh @AndriianChestnykh Just for clarify, this unit test demonstrates an overflow vulnerability. A similar one was found in sismo, which prompted looking for one here (sismo's query code was inspired by iden3's). |
|
@BlakeMScurr , thanks for letting us know. It looks reasonable and we'll be applying the fix soon. |
|
Hello @BlakeMScurr! Technically this is not a bug.
We will add full support for negative numbers in the near future. Thank you for your report! It helped us to spot a few other bugs related to negative number handling. Some of them are already fixed. For now I'm closing this PR. |
|
Hi @OBrezhniev! That's a fair point for I should be able to change the PR and show that the breaking point doesn't exactly correspond to the negative numbers if you like, when I have some time. |
|
Hi @BlakeMScurr, have you been able to determine what is the "breaking point"? |
|
Hi @enricobottazzi! So I would argue that it "fails" in the case discuss above by saying that But @OBrezhniev's argument is fine: if you want negative numbers then I kinda think of
Does that make sense? |
The following test fails by outputting 1 rather than 0. You should expect
218...616 < 10to be true, but it's not due to an overflow error described here.I would suggest using
CompConstantto verify that the inputs are less than2^252, but perhaps there's a more efficient way to do that in the context of the codebase.