Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Static analysis for languages with exception handling

https://doi.org/10.15514/ISPRAS-2022-34(6)-1

Abstract

This paper describes static analysis for the languages with exception handling. A low level intermediate representation, which supports exceptions, is proposed in this study. Data flow analyses for unreachable code detection were described. А general scheme of static analysis that takes exception related paths into account was given. The algorithms were implemented as a part of the static analysis tool Svace for C++, Java and Kotlin languages.

About the Authors

Vitaly Olegovich AFANASYEV
Ivannikov Institute for System Programming of the RAS, National Research University Higher School of Economics
Russian Federation

Graduate Student at the Faculty of Computer Science, NRU HSE, employee of ISP RAS



Varvara Viktorovna DVORTSOVA
Ivannikov Institute for System Programming of the RAS, Lomonosov Moscow State University
Russian Federation

Graduate Student at the Faculty of Computational Mathematics and Cybernetics of Moscow State University, employee of ISP RAS



Alexey Evgenevich BORODIN
Ivannikov Institute for System Programming of the RAS
Russian Federation

PhD, researcher of ISP RAS



References

1. Common Weakness Enumeration. CWE-703: Improper Check or Handling of Exceptional Conditions. URL: https://cwe.mitre.org/data/definitions/703.html, accessed 28.01.2022.

2. Иванников В.П., Белеванцев А.А. и др. Статический анализатор Svace для поиска дефектов в исходном коде программ. Труды ИСП РАН, том 26, вып. 1, 2014 г., стр. 231-250. DOI: 10.15514/ISPRAS-2014-26(1)-7 / Ivannikov V.P., Belevantsev A.A. et al. Static analyzer Svace for finding defects in a source program code. Programming and Computer Software, vol. 40, issue 5, 2014, pp. 265-275.

3. Бородин А.Е., Горемыкин А.В. и др. Поиск уязвимостей небезопасного использования помеченных данных в статическом анализаторе Svace. Труды ИСП РАН, том 33, вып. 1, 2021 г., стр. 7-32. DOI: 10.15514/ISPRAS–2021–33(1)–1 / Borodin A., Goremykin A. et al. Searching for Taint Vulnerabilities with Svace Static Analysis Tool. Programming and Computer Software, vol. 47, issue 6, 2021, pp. 466-481.

4. Бородин А.Е., Дудина И.А. Внутрипроцедурный анализ для поиска ошибок на основе символьного выполнения. Труды ИСП РАН, том 32, вып. 6, 2020 г., стр. 87-100. DOI: 10.15514/ISPRAS–2020–32(6)–7 / Borodin A., Dudina I. Intraprocedural Analysis Based on Symbolic Execution for Bug Detection. Programming and Computer Software, vol. 47, issue 8, 2021, pp. 858-865.

5. Common Weakness Enumeration. CWE-460: Improper Cleanup on Thrown Exception. URL: https://cwe.mitre.org/data/definitions/460.html, accessed 28.01.2022.

6. Дудина И.А., Кошелев В.К., Бородин А.Е. Поиск ошибок доступа к буферу в программах на языке C/C++. Труды ИСП РАН, том 28, вып. 4, 2016 г., стр. 149-168 / Dudina I., Koshelev V., Borodin A. Statically detecting buffer overflows in C/C++. Trudy ISP RAN /Proc. ISP RAS, vol. 28, issue 4, 2016, pp. 149-168 (in Russian). DOI: 10.15514/ISPRAS-2016-28(4)-9.

7. Мулюков Р.Р., Бородин А.Е. Использование анализа недостижимого кода в статическом анализаторе для поиска ошибок в исходном коде программ. Труды ИСП РАН, том 28, вып. 5, 2016 г., стр. 145-158 / Mulyukov R.R., Borodin A.E. Using unreachable code analysis in static analysis tool for finding defects in source code. Trudy ISP RAN/Proc. ISP RAS, 2016, vol. 28, issue 5, 2016, pp. 145-158 (in Russian). DOI: 10.15514/ISPRAS-2016-28(5)-9.

8. Common Weakness Enumeration. CWE-248: Uncaught exception. URL: https://cwe.mitre.org/data/definitions/248.html, accessed 28.01.2022.

9. Working Draft, Standard for Programming Language C++. 18.5.1 The std::terminate() function. URL: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4713.pdf, accessed 12.08.2022.

10. Oracle Java Documentation: The Java Tutorials. Trail: The Reflection API. URL: https: //docs.oracle.com/javase/tutorial/reflect/index.html, accessed 17.05.2022).

11. OpenJDK. The Java programming language Compiler Group. URL: https://openjdk.org/groups/compiler/, accessed 12.08.2022.

12. JetBrains/kotlin. The Kotlin Programming Language. URL: https://github.com/JetBrains/kotlin, accessed 22.04.2022.

13. Clang: a C language family frontend for LLVM. URL: https://clang.llvm.org/, accessed 12.08.2022.

14. LLVM Compiler Infrastructure. Exception Handling in LLVM. Itanium ABI Zero-cost Exception Handling. URL: https://llvm.org/docs/ExceptionHandling.html#itaniumabi-zero-cost-exception-handling, accessed 11.08.2022.

15. LLVM Compiler Infrastructure. Exception Handling in LLVM. Exception Handling using the Windows Runtime. URL: https://llvm.org/docs/ExceptionHandling.html#exceptionhandling-using-the-windows-runtime, accessed 11.08.2022.

16. ASM. URL: https://asm.ow2.io/, accessed 18.08.2022.

17. LLVM Compiler Infrastructure. Exception Handling in LLVM. Try/Catch. URL: https://llvm.org/docs/ExceptionHandling.html#try-catch, accessed 11.08.2022.

18. Lindholm T., Yellin F. et al. The Java® Virtual Machine Specification. Java SE 8 Edition. Exceptions and finally. URL: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.2.5, accessed 20.12.2021.

19. Меркулов А.П., Поляков С.А., Белеванцев А.А. Анализ программ на языке Java в инструменте Svace. Труды ИСП РАН, том 29, вып. 3, 2017 г., стр. 57-74 / Merkulov A.P., Polyakov S.A., Belevantsev A.A. Supporting Java programming in the Svace static analyzer. Trudy ISP RAN/Proc. ISP RAS, vol. 29, issue 3, 2017. pp. 57-74 (in Russian). DOI: 10.15514/ISPRAS-2017-29(3)-5.

20. Android Open Source Project. URL: https://source.android.com/, accessed 22.04.2022.

21. xbmc/xbmc - Kodi Home Theater Software! URL: https://github.com/xbmc/xbmc, accessed 18.08.2022.

22. Tizen Docs. URL: https://docs.tizen.org/, accessed 18.08.2022.

23. Krishnamurthy R., Piskachev G., Bodden E. To what extent can we analyze Kotlin programs using existing Java taint analysis tools? arXiv preprint arXiv:2207.09379, 2022, 12 p.

24. Piskachev G., Krishnamurthy R., Bodden E. SecuCheck: Engineering configurable taint analysis for software developers. In Proc. of the IEEE 21st International Working Conference on Source Code Analysis and Manipulation (SCAM), 2021, pp. 24—29.

25. Clang Static Analyzer. URL: https://clang-analyzer.llvm.org/, accessed 17.08.2022.

26. Prabhu P., Maeda et al. Interprocedural exception analysis for C++. Lecture Notes in Computer Science, vol. 6813, 2011, pp. 583-608.

27. Кошелев В.К., Игнатьев В.Н., Борзилов А.И. Инфраструктура статического анализа программ на языке C#. Труды ИСП РАН, том 28, вып. 1, 2016 г., стр. 21-40. DOI: 10.15514/ISPRAS-2016-28(1)-2 / Koshelev V.K., Ignatiev V.N. et al. SharpChecker: Static analysis tool for C# programs. Programming and Computer Software, vol. 43, issue 4, 2017, pp. 268—276.

28. Belyaev M., Ignatyev V. Exception Analysis for Errors Detection in the SharpChecker Static Analyzer for C#. In Proc. of the 2021 Ivannikov ISPRAS Open Conference, 2021, pp. 8-16.

29. SpotBugs. Find bugs in Java Programs. URL: https://spotbugs.github.io/, accessed 22.04.2022.

30. Infer. URL: https://fbinfer.com/, accessed 22.04.2022.


Review

For citations:


AFANASYEV V.O., DVORTSOVA V.V., BORODIN A.E. Static analysis for languages with exception handling. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2022;34(6):7-28. (In Russ.) https://doi.org/10.15514/ISPRAS-2022-34(6)-1



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)