RUS  ENG
Full version
JOURNALS // Proceedings of the Institute for System Programming of the RAS // Archive

Proceedings of ISP RAS, 2023 Volume 35, Issue 6, Pages 121–134 (Mi tisp836)

Detecting potentially clobbered variables due to the use of nonlocal jumps functions

N. Yu. Shugaleyab, V. A. Ivanishina, A. V. Monakova

a Ivannikov Institute for System Programming of the RAS
b Moscow Institute of Physics and Technology

Abstract: The reason of undefined behavior is source code written in violation of the C language standard. Undefined behavior leads to vulnerabilities in software. One of the common sources of undefined behavior is an incorrect use of functions for nonlocal jumps (in particular setjmp and longjmp). This paper considers the means of detecting this type of undefined behavior which are implemented in the major modern compilers (GCC, Clang, MSVC). We conclude that these means either have significant disadvantages or are absent in some compilers. This paper presents the implementation of a new method of compiler warning of the considered undefined behavior. The described method is accurate enough for practical application on real projects. We consider the advantages of the proposed solution over similar existing ones.

Keywords: compilers, c, nonlocal jumps, setjmp, volatile, undefined behavior, static analysis

DOI: 10.15514/ISPRAS-2023-35(6)-7



© Steklov Math. Inst. of RAS, 2024