Another year is drawing to an end, and it’s a perfect time to make yourself a cup of coffee and reread the reviews of bugs collected across open-source projects over this year. This would take quite a while, of course, so we prepared this article to make it easier for you. Today we’ll be recalling the most interesting dark spots that we came across in open-source C/C++ projects in 2019.

No. 10. What Operating System Are We running On?

V1040 Possible typo in the spelling of a pre-defined macro name. The ‘_MINGW32’ macro is similar to ‘MINGW32’. winapi.h 4112

#if !defined(__UNICODE_STRING_DEFINED) && defined(__MINGW32_)
#define __UNICODE_STRING_DEFINED
#endif

There is a typo in the name of the _MINGW32 macro (MINGW32 is actually declared by MINGW32). Elsewhere in the project, the check is written correctly:

By the way, this bug was not only the first to be described in the article “CMake: the Case when the Project’s Quality is Unforgivable” but the very first genuine bug found by the V1040 diagnostic in a real open-source project (August 19, 2019).

#c++ #cpp #static-analyzer #bugs #pvs-studio #vulnerabilities #clean-code #code-quality

Top 10 C++ Open Source Project Bugs Found in 2019
1.35 GEEK