Top "Integer-overflow" questions

Integer overflow occurs when the result of an operation is larger than the maximal value that can be represented by the underlying integer type.

(-2147483648> 0) returns true in C++?

-2147483648 is the smallest integer for integer type with 32 bits, but it seems that it will overflow in the if(...) …

c++ integer-overflow
Modular Exponentiation for high numbers in C++

So I've been working recently on an implementation of the Miller-Rabin primality test. I am limiting it to a scope …

c++ modulo integer-overflow exponentiation
Wrap around explanation for signed and unsigned variables in C?

I read a bit in C spec that unsigned variables(in particular unsigned short int) perform some so called wrap …

c integer-overflow
How to deal with a wrapping counter in embedded C

I need to deal with a counter that gives me ticks for my application. The counter is 32bits so what …

c embedded integer-overflow
How does one safely static_cast between unsigned int and int?

I have an 8-character string representing a hexadecimal number and I need to convert it to an int. This conversion …

c++ casting integer-overflow openvms
Why is (18446744073709551615 == -1) true?

When I was working on string::npos I noticed something and I couldn't find any explanation for it on the …

c++ equality unsigned signed integer-overflow
What is an integer overflow error?

What is an integer overflow error? Why do i care about such an error? What are some methods of avoiding …

language-agnostic integer-overflow
How is integer overflow exploitable?

Does anyone have a detailed explanation on how integers can be exploited? I have been reading a lot about the …

security integer-overflow exploit
How to handle arbitrarily large integers

I'm working on a programming language, and today I got the point where I could compile the factorial function(recursive), …

c++ integer overflow long-integer integer-overflow
Question about C behaviour for unsigned integer underflow

I have read in many places that unsigned integer overflow is well-defined in C unlike the signed counterpart. Is underflow …

c integer types integer-overflow underflow