Integer Security - Northern Kentucky University

Integer Security

CSC 482/582: Computer Security

Slide #1

Topics

1. Computer Integers 2. Integers in C and Java 3. Undefined Behavior 4. Overflow Examples 5. Checking for Overflows

CSC 482/582: Computer Security

256th "Split Screen" level of Pac-Man

Slide #2

Integer Overflow

December 25, 2004

Flight crew scheduling software stopped. Cancelled all 1100 flights that day.

What happened?

Winter weather led to many crew changes. Number of changes > 32,767

CSC 482/582: Computer Security

Slide #3

Computer Integers

Computer integers are not the same set of numbers as mathematical integers.

Finite set, not infinite.

What happens when integer calculations result in a number outside that set?

Set carry or overflow flag in CPU. Throw an exception. Convert integer type to higher precision. Saturation (remain at maximum/minimum value). Wrap from max to min or min to max value.

Depends on language and hardware.

CSC 482/582: Computer Security

Slide #4

Unsigned Integers

0 7

000 111

1 001

6

110

010

2

101 5

CSC 482/582: Computer Security

011

100

3

4

Slide #5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download