Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The following sections examine specific operations that are susceptible to unsigned integer wrap. When operating on small integer types (smaller than int), integer promotions are applied. The usual arithmetic conversions may also be applied to (implicitly) convert operands to equivalent types before arithmetic operations are performed. Make sure you understand integer conversion rules before trying to implement secure arithmetic operations (see INT02-C. Understand integer conversion rules).

Integer values that originate from untrusted sources must not be allowed to wrap if they are used in any of the following ways: