Understanding Integer Overflow in C/C++
Authors:
Open Access
- 2 December 2015
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Software Engineering and Methodology
- Vol. 25 (1) , 1-29
Abstract
Integer overflow bugs in C and C++ programs are difficult to track down and may lead to fatal errors or exploitable vulnerabilities. Although a number of tools for finding these bugs exist, the situation is complicated because not all overflows are bugs. Better tools need to be constructed, but a thorough understanding of the issues behind these errors does not yet exist. We developed IOC, a dynamic checking tool for integer overflows, and used it to conduct the first detailed empirical study of the prevalence and patterns of occurrence of integer overflows in C and C++ code. Our results show that intentional uses of wraparound behaviors are more common than is widely believed; for example, there are over 200 distinct locations in the SPEC CINT2000 benchmarks where overflow occurs. Although many overflows are intentional, a large number of accidental overflows also occur. Orthogonal to programmers' intent, overflows are found in both well-defined and undefined flavors. Applications executing undefined operations can be, and have been, broken by improvements in compiler optimizations. Looking beyond SPEC, we found and reported undefined integer overflows in SQLite, PostgreSQL, SafeInt, GNU MPC and GMP, Firefox, LLVM, Python, BIND, and OpenSSL; many of these have since been fixed.Keywords
Funding Information
- DARPA's Computer Science Study Group
- Air Force Research Laboratory
This publication has 5 references indexed in Scilit:
- As-If Infinitely Ranged Integer Model2010
- BRICK: A Binary Tool for Run-Time Detecting and Locating Integer-Based Vulnerability2009
- LLVM: A compilation framework for lifelong program analysis & transformation2004
- ValgrindElectronic Notes in Theoretical Computer Science, 2003
- An investigation of the Therac-25 accidentsComputer, 1993