4 ms·
Worse, it is not even a certain check against integer overflow. A particularly large expression could have overflowed substantially enough that it becomes posi
by jwise0 13y ago
Worse, it is not even a certain check against integer overflow. A particularly large expression could have overflowed substantially enough that it becomes positive again!
This, in fact, was the source of a vulnerability in PHP [1]. (The way they 'resolved' it, uh, isn't much better.)
There is almost never a magic bullet for integer overflow. Programming secure systems requires thought.
[1] http://use.perl.org/use.perl.org/_Aristotle/journal/33448.html http://use.perl.org/use.perl.org/_Aristotle/journal/33448.ht...
- deleted 13y ago[deleted]
- comex 13y agoNote that since it says 'size == 0', it's not merely "not a certain check", but a check that passes for almost all overflowing values :)