[Cryptography] GCC bug 30475
Nemo
nemo at self-evident.org
Fri Apr 25 12:17:52 EDT 2014
Bear <bear at sonic.net> writes:
> There are in fact conformant checks for signed overflow.
>
> For example, you can say
>
> if (MAXINT - al >= be) halt(2); // overflow check - not using assert()
What does that do if al is -1?
The usual approaches are more complex. See:
http://stackoverflow.com/questions/6856227/
...and everything it references, especially:
https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
On the bright side, you only have to solve this problem once.
- Nemo
https://self-evident.org/
More information about the cryptography
mailing list