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.