Integer overflow: Difference between revisions

Content deleted Content added
Codename Lisa (talk | contribs)
m General Fixes using AWB
Line 1:
[[Image:Odometer_rolloverOdometer rollover.jpg|thumb|250px|[[Odometer]] rollover, a mechanical form of integer overflow. All digits are set to the maximum 9, and adding 1 causes a cascade of carry-over additions setting all digits to 0 but there is no higher digit to change to a 1, so the counter resets to zero.]]
 
In [[computer programming]], an '''integer overflow''' occurs when an [[arithmetic]] operation attempts to create a numeric value that is too large to be represented within the available storage space. For instance, adding 1 to the largest value that can be represented constitutes an integer overflow. The most common result in these cases is for the least significant representable bits of the result to be stored (the result is said to ''wrap''). On some processors like [[Graphics processing unit|GPU]]s and [[Digital signal processor|DSP]]s, the result [[saturation arithmetic|saturates]]; that is, once the maximum value is reached, attempts to make it larger simply return the maximum result.
Line 10:
: 16 bits: maximum representable value 2<sup>16</sup> − 1 = 65,535
: 32 bits: maximum representable value 2<sup>32</sup> − 1 = 4,294,967,295 (the most common width for personal computers {{As of|2005|lc=on}}),
: 64 bits: maximum representable value 2<sup>64</sup> − 1 = 18,446,744,073,709,551,615 (the most common width for personal computers, but not necessarily their [[Operatingoperating system|operating systems]]s, {{As of|2012|lc=on}}),
: 128 bits: maximum representable value 2<sup>128</sup> − 1 = 340,282,366,920,938,463,463,374,607,431,768,211,455
 
Line 57:
*[http://thetaeng.com/TimerWrap.htm How to implement efficiently in C]
*[http://projects.webappsec.org/Integer-Overflows WASC Threat Classification - Integer Overflows]
 
[[Category:Software bugs]]
[[Category:Computer security exploits]]