An integer overflow is the condition that occurs when the result of an arithmeti
ID: 3814819 • Letter: A
Question
An integer overflow is the condition that occurs when the result of an arithmetic operation, such as multiplication or addition, exceeds the maximum size of the integer type used to store it. If the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value. It is often a critical security flaw in software.
For example, in a 16-bit integer system, 19458*37=64586. The result is supposed to be 719946, but has more than 16 bits. Therefore, the result is wrapped, i.e. only the least significant 16 bits of the result remain.
Consider in a 32-bit integer system,
(1) Let Z = 0xFEDCBA98. What is the result of Z + 0x10000000 ? Note that the result must be a 32-bit integer, because this is a 32-bit integer system.
(2) Let Y = 0xFEDCBA98. What is the result of Y * 0x10 ? Note that the result must be a 32-bit integer, because this is a 32-bit integer system.
(3) Find "X" that satisfies the following equations.
X > 1337
X * 7 + 4 = 1337
Explanation / Answer
1) Z = 0xFEDCBA98. What is the result of Z + 0x10000000
0xFEDCBA98
0x10000000
------------------------
0x0EDCBA98
============
2) What is the result of Y * 0x10
Y = 00000000
Y = 0xFEDCBA98
====================
0xEDCBA980
=================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.