Integer overflow: Difference between revisions

Content deleted Content added
Methods to address integer overflow problems: Added meaning of abbreviation "ubsan".
No edit summary
Line 10:
An overflow condition may give results leading to unintended behavior. In particular, if the possibility has not been anticipated, overflow can compromise a program's reliability and [[software security|security]].
 
For some applications, such as timers and clocks, wrapping on overflow can be desirable. The [[C (programming language)#C11|C11]] standard states that for unsigned integers, modulo wrapping is the defined behavior and the term overflow never applies: "a computation involving unsigned operands can never overflow."<ref name="auto">{{cite web |url=https://webstore.ansi.org/RecordDetail.aspx?sku=ISO/IEC+9899:2011 |title=ISO/IEC 9899:2011 Information technology - Programming languages - C |author=ISO staff |website=ANSI.org}}</ref>
 
On some processors like [[graphics processing unit]]s (GPUs) and [[digital signal processor]]s (DSPs) which support [[saturation arithmetic]], overflowed results would be "clamped", i.e. set to the minimum or the maximum value in the representable range, rather than wrapped around.