Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3351556.3351559acmotherconferencesArticle/Chapter ViewAbstractPublication PagesbciConference Proceedingsconference-collections
research-article

Categorization of C++ Classes for Static Lifetime Analysis

Published: 26 September 2019 Publication History

Abstract

While C++ is a powerful language, it has many subtle ways to introduce object lifetime-related errors. According to Microsoft, 70% of their security patches are fixing memory issues. Thus, it is crucial to develop safety measures to counteract these problems. Static analysis is an essential approach to detect runtime errors by analyzing the source code without executing it. One of the reasons why is it so easy to make mistakes using C++ is that the language provides a rich taxonomy of object lifetime-related concepts such as containers, values, iterators, raw pointers, lvalue and rvalue references, smart pointers, etc. The behavior of user-defined types depends on their category. Classical static analysis approaches treat user-defined types as black boxes and do not reason about their correctness.
In this paper, we argue for an approach that infers the category of user-defined types and leverages this information during analysis. To achieve this goal we first analyze user-defined classes to predict their ownership semantics. Then we use this information to generalize existing static analysis methods. We evaluated the proposed method on large open source projects.

References

[1]
{n. d.}. C++ Core Guidelines, a set of tried-and-true guidelines, rules, and best practices about coding in C++. https://github.com/isocpp/CppCoreGuidelines (last accessed: 28-02-2019).
[2]
{n. d.}. Clang Static Analyzer, a source code analysis tool that finds bugs in C, C++, and Objective-C programs. https://clang-analyzer.llvm.org/ (last accessed: 28-02-2019).
[3]
{n. d.}. Clang-Tidy, a Clang-based C++ "linter" tool. https://clang.llvm.org/extra/clang-tidy (last accessed: 28-02-2019).
[4]
{n. d.}. A GitHub mirror of the official Clang repository. https://github.com/llvm-mirror/clang (last accessed: 28-02-2019).
[5]
Dave Clarke, Johan östlund, Ilya Sergey, and Tobias Wrigstad. 2013. Ownership types: A survey. In Aliasing in Object-Oriented Programming. Types, Analysis and Verification. Springer, 15--58.
[6]
Patrick Cousot and Radhia Cousot. 1977. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. ACM, 238--252.
[7]
Christian DeLozier, Richard Eisenberg, Santosh Nagarakatte, Peter-Michael Osera, Milo M.K. Martin, and Steve Zdancewic. 2013. Ironclad C++: A Library-augmented Type-safe Subset of C++. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA '13). ACM, New York, NY, USA, 287--304.
[8]
Gábor Horváth, Péter Szécsi, Zoltán Gera, Dániel Krupp, and Norbert Pataki. 2018. Challenges of Implementing Cross Translation Unit Analysis in Clang Static Analyzer. In 2018 IEEE 18th International Working Conference on Source Code Analysis and Manipulation (SCAM). 171--176.
[9]
Jaakko Järvi and John Freeman. 2010. C++ lambda expressions and closures. Science of Computer Programming 75 (2010), 762--772.
[10]
Réka Kovács. 2018. A checker for dangling string pointers in the Clang Static Analyzer. http://lists.llvm.org/pipermail/cfe-dev/2018-August/058907.html (last accessed: 28-02-2019).
[11]
Amruth N. Kumar. 2001. Learning the Interaction Between Pointers and Scope in C++. SIGCSE Bull. 33, 3 (June 2001), 45--48.
[12]
Chris Lattner. 2008. LLVM and Clang: Next Generation Compiler Technology. (2008). Lecture at BSD Conference 2008.
[13]
Daniel Marjamäki. 2013. CppCheck: a tool for static C/C++ code analysis. http://cppcheck.sourceforge.net/ (last accessed: 28-02-2019).
[14]
Nicholas D Matsakis and Felix S Klock II. 2014. The rust language. In ACM SIGAda Ada Letters, Vol. 34. ACM, 103--104.
[15]
Matt Miller. 2018. Trends, Challenges, and Strategic Shifts in the Software Vulnerability Mitigation Landscape. https://www.zdnet.com/article/microsoft-70-percent-of-all-security-bugs-are-memory-safety-issues/ (last accessed: 28-02-2019).
[16]
Norbert Pataki. 2011. C++ Standard Template Library by Safe Functors. In Proc. of 8th Joint Conference on Mathematics and Computer Science, MaCS 2010, Selected Papers, H. F. Pop and A. Bege (Eds.). Novadat Ltd., Komárno, 363--374.
[17]
Norbert Pataki, Zalán Szűgyi, and Gergely Dévai. 2011. Measuring the Overhead of C++ Standard Template Library Safe Variants. Electronic Notes in Theoretical Computer Science 264, 5 (2011), 71--83.
[18]
Konstantin Serebryany, Derek Bruening, Alexander Potapenko, and Dmitriy Vyukov. 2012. AddressSanitizer: A fast address sanity checker. In Presented as part of the 2012 {USENIX} Annual Technical Conference ({USENIX}{ATC} 12). 309--318.
[19]
Bjarne Stroustrup. 2013. The C++ Programming Language (4th ed.). Addison-Wesley Professional.
[20]
Herb Sutter. 2018. Lifetime safety: Preventing common dangling. Technical Report. Microsoft Corporation.
[21]
Herb Sutter. 2018. Thoughts on a more powerful and simpler C++ (5 of N). https://www.youtube.com/watch?v=80BZxujhY38 (last accessed: 28-02-2019).
[22]
Xusheng Xiao, Gogul Balakrishnan, Franjo Ivančić, Naoto Maeda, Aarti Gupta, and Deepak Chhetri. 2014. ARC+ +: effective typestate and lifetime dependency analysis. In Proceedings of the 2014 International Symposium on Software Testing and Analysis. ACM, 116--126.

Cited By

View all
  • (2024)Uncovering Hidden Dependencies: Constructing Intelligible Path Witnesses using Dataflow AnalysesActa Cybernetica10.14232/actacyb.29980526:3(713-747)Online publication date: 4-Mar-2024
  • (2020)Detecting Uninitialized Variables in C++ with the Clang Static AnalyzerActa Cybernetica10.14232/actacyb.28290025:4(923-940)Online publication date: 19-Nov-2020

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
BCI'19: Proceedings of the 9th Balkan Conference on Informatics
September 2019
225 pages
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

In-Cooperation

  • Technical University of Sofia

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 26 September 2019

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. lifetime analysis
  2. static analysis
  3. the C++ programming language

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Conference

BCI'19
BCI'19: 9th Balkan Conference in Informatics
September 26 - 28, 2019
Sofia, Bulgaria

Acceptance Rates

BCI'19 Paper Acceptance Rate 24 of 73 submissions, 33%;
Overall Acceptance Rate 97 of 250 submissions, 39%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)19
  • Downloads (Last 6 weeks)6
Reflects downloads up to 29 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Uncovering Hidden Dependencies: Constructing Intelligible Path Witnesses using Dataflow AnalysesActa Cybernetica10.14232/actacyb.29980526:3(713-747)Online publication date: 4-Mar-2024
  • (2020)Detecting Uninitialized Variables in C++ with the Clang Static AnalyzerActa Cybernetica10.14232/actacyb.28290025:4(923-940)Online publication date: 19-Nov-2020

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media