Integer overflow: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Added date. | Use this bot. Report bugs. | Suggested by Whoop whoop pull up | Category:Software bugs | #UCB_Category 13/83
Tag: Reverted
Line 30:
Such wraparound may cause security detriments—if an overflowed value is used as the number of bytes to allocate for a buffer, the buffer will be allocated unexpectedly small, potentially leading to a buffer overflow which, depending on the use of the buffer, might in turn cause arbitrary code execution.
 
If the variable has a [[Signed number representations|signed integer]] type, a program may make the assumption that a variable always contains a positive value. An integer overflow can cause the value to wrap and become negative, which violates the program's assumption and may lead to unexpected behavior (for example, 8-bit integer addition of 127 + 1 results in −128, a two's complement of 128). (A solution for this particular problem is to use unsigned integer types for values that a program expects and assumes will never be negative.)piggggggg
 
==Flags==