4 ms·
why wouldn't it wrap around?
by forensic 16y ago
why wouldn't it wrap around?
- btn 16y agoInteger overflow behavior varies a lot between languages; it can be undefined, some wrap around, others promote to a larger integer type, others convert the type to something else, and some clamp to the largest (or smallest) value. For example, if you're using PHP, an integer will turn into a float when it overflows; if you then push the value into a MySQL databse, it'll be clamped.
- SerpentJoe 16y agoScary thought: this bug is nice and obvious when the data gets "clamped" to max_int, but what about when it doesn't and overflows to some value in the middle? No way to tell how many systems suffer from that flavor.