skip to main content
10.5555/2337223.2337313acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
Article

Understanding integer overflow in C/C++

Published: 02 June 2012 Publication History

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, GCC, LLVM, Python, BIND, and OpenSSL; many of these have since been fixed. Our results show that integer overflow issues in C and C++ are subtle and complex, that they are common even in mature, widely used programs, and that they are widely misunderstood by developers.

References

[1]
MITRE Corporation, "CVE-2002-0639: Integer overflow in sshd in OpenSSH," 2002, http://cve.mitre.org/cgibin/ cvename.cgi?name=CVE-2002-0639.
[2]
MITRE Corporation, "CVE-2010-2753: Integer overflow in Mozilla Firefox, Thunderbird and SeaMonkey," 2010, http://cve.mitre.org/cgibin/ cvename.cgi?name=CVE-2010-2753.
[3]
S. Christey, R. A. Martin, M. Brown, A. Paller, and D. Kirby, "2011 CWE/SANS Top 25 Most Dangerous Software Errors," MITRE Corporation, Tech. Report, September 2011, http://cwe.mitre.org/top25.
[4]
D. Brumley, T. Chiueh, R. Johnson, H. Lin, and D. Song, "RICH: Automatically protecting against integer-based vulnerabilities," in Proc. of the Symp. on Network and Distributed Systems Security (NDSS), San Diego, CA, USA, Feb. 2007.
[5]
"clang: a C language family frontend for LLVM," http://clang.llvm.org/; accessed 21-Sept-2011.
[6]
ISO, ISO/IEC 14882:2011: Programming languages -- C++. International Organization for Standardization, 2011. {Online}. Available: http://www.iso.org/iso/iso_catalogue/ catalogue_tc/catalogue_detail.htm?csnumber=50372
[7]
D. LeBlanc, "Integer handling with the C++ SafeInt class," 2004, http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dncode/html/secure01142004.asp.
[8]
D. LeBlanc, "Author's blog: Integer handling with the C++ SafeInt class," http://safeint.codeplex.com/.
[9]
C. Lattner and V. Adve, "LLVM: A compilation framework for lifelong program analysis & transformation," in Proc. of the 2004 Intl. Symp. on Code Generation and Optimization (CGO'04), Palo Alto, CA, USA, Mar. 2004.
[10]
CERT, "IntegerLib, a secure integer library," 2006, http://www.cert.org/secure-coding/IntegerLib.zip.
[11]
D. Hodges, "Why do Pinky and Inky have different behaviors when Pac-Man is facing up?" Dec. 2008, http://donhodges.com/pacman_pinky_explanation.htm; accessed 21-Sept-2011.
[12]
Wikipedia, "Pac-Man," 2011, http://en.wikipedia.org/w/ index.php?title=Pac-Man&oldid=450692749#Split-screen; accessed 21-Sept-2011.
[13]
S. Christey and R. A. Martin, "Vulnerability type distributions in CVE," MITRE Corporation, Tech. Report, May 2007, http://cwe.mitre.org/documents/vuln-trends.html.
[14]
Wikipedia, "Arbitrary-precision arithmetic," 2011, http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic; accessed 21-Sept-2011.
[15]
MITRE Corporation, "Common Vulnerability and Exposures," http://cve.mitre.org/.
[16]
P. Chen, Y. Wang, Z. Xin, B. Mao, and L. Xie, "Brick: A binary tool for run-time detecting and locating integer-based vulnerability," in Proc. of the 4th Intl. Conf. on Availability, Reliability and Security, Fukuoka, Japan, Mar. 2009, pp. 208- 215.
[17]
N. Nethercote and J. Seward, "Valgrind: A program supervision framework," in Proc. of the 3rd Workshop on Runtime Verification, Boulder, CO, Jul. 2003.
[18]
D. Molnar, X. C. Li, and D. A. Wagner, "Dynamic test generation to find integer bugs in x86 binary Linux programs," in Proc. of the 18th USENIX Security Symposium, 2009, pp. 67-82.
[19]
T. Wang, T. Wei, Z. Lin, and W. Zou, "IntScope: Automatically detecting integer overflow vulnerability in x86 binary using symbolic execution," in Proc. of the 16th Network and Distributed System Security Symp., San Diego, CA, USA, Feb. 2009.
[20]
R. B. Dannenberg, W. Dormann, D. Keaton, R. C. Seacord, D. Svoboda, A. Volkovitsky, T. Wilson, and T. Plum, "Asif infinitely ranged integer model," in Proc. of the 21st Intl. Symp. on Software Reliability Engineering (ISSRE 2010), San Jose, CA, USA, Nov. 2010, pp. 91-100.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '12: Proceedings of the 34th International Conference on Software Engineering
June 2012
1657 pages
ISBN:9781467310673

Sponsors

Publisher

IEEE Press

Publication History

Published: 02 June 2012

Check for updates

Qualifiers

  • Article

Conference

ICSE '12
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)11
  • Downloads (Last 6 weeks)0
Reflects downloads up to 30 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media