diff --git a/cxx-sensors/src/main/resources/cppcheck.xml b/cxx-sensors/src/main/resources/cppcheck.xml index b9eb0a5a4f..732d03902c 100644 --- a/cxx-sensors/src/main/resources/cppcheck.xml +++ b/cxx-sensors/src/main/resources/cppcheck.xml @@ -2106,9 +2106,14 @@ Negative array index Memory allocation size is negative +Memory allocation size is negative. +

+

References

+

CWE-131: Incorrect Calculation of Buffer Size

]]>
+ cwe BUG LINEAR 5min @@ -8487,7 +8492,7 @@ Variable 'x' can be declared with const constParameter - Variable 'x' can be declared with const + Parameter 'x' can be declared with const @@ -8987,8 +8992,8 @@ missing return statement Member variable 'classname::varnamepriv' is not assigned in the copy constructor -Member variable 'classname::varnamepriv' is not assigned in the copy -constructor. Should it be copied? +Member variable 'classname::varnamepriv' is not assigned in the move +constructor. Should it be moved?

References

CWE-398: 7PK - Code Quality

@@ -8999,6 +9004,102 @@ constructor. Should it be copied? LINEAR 5min
+ + + constParameterCallback + Parameter 'x' can be declared with const, however it seems that 'f' is a callback function + + MINOR + LINEAR + 5min + + + + internalAstError + Internal Error: AST + + Syntax Error: AST broken or maximum AST depth exceeded. + + internalAstError + INFO + BUG + LINEAR + 5min + + + syntaxError + Internal Error: Syntax error + + Cppcheck cannot tokenize the code correctly: unsupported syntax or invalid code. + + syntaxError + INFO + BUG + LINEAR + 5min + + + "unknownMacro + Internal Error: Unkown macro + + There is an unknown macro here somewhere. Configuration is required. If 'token' is a macro then please configure it. + + "unknownMacro + INFO + BUG + LINEAR + 5min + + + cppcheckError + Internal Error + + Analysis failed. If the code is valid then please report this failure. + + cppcheckError + INFO + BUG + LINEAR + 5min + + + cppcheckLimit + Internal Error: Internal limit + + Internal limit: CheckLeakAutoVar::checkScope() Maximum recursive count of 1000 reached. + + cppcheckLimit + INFO + BUG + LINEAR + 5min + + + instantiationError + Internal Error: Instantiation error + + Instantiation error: Divide by zero in template instantiation. + + instantiationError + INFO + BUG + LINEAR + 5min + + + unmatchedSuppression + Internal Error: Unmatched suppression + + Unmatched suppression: unusedFunction. + + unmatchedSuppression + INFO + BUG + LINEAR + 5min + misra-c2012-1.1 diff --git a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java index f8271d3dc4..1e52bb59b0 100644 --- a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java +++ b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/cppcheck/CxxCppCheckRuleRepositoryTest.java @@ -37,7 +37,7 @@ void createRulesTest() { def.define(context); RulesDefinition.Repository repo = context.repository(CxxCppCheckRuleRepository.KEY); - assertThat(repo.rules()).hasSize(666); + assertThat(repo.rules()).hasSize(674); } } diff --git a/cxx-sensors/src/tools/cwec_latest.xml.zip b/cxx-sensors/src/tools/cwec_latest.xml.zip index 9abc5ee6e3..f2ffa35dcb 100644 Binary files a/cxx-sensors/src/tools/cwec_latest.xml.zip and b/cxx-sensors/src/tools/cwec_latest.xml.zip differ diff --git a/cxx-sensors/src/tools/generate_cppcheck_resources.cmd b/cxx-sensors/src/tools/generate_cppcheck_resources.cmd index 8904bd1319..5e810f5a62 100644 --- a/cxx-sensors/src/tools/generate_cppcheck_resources.cmd +++ b/cxx-sensors/src/tools/generate_cppcheck_resources.cmd @@ -5,7 +5,7 @@ SET SCRIPT_DIR=%~dp0 SET CPPCHECK_DIR=C:\Program Files\Cppcheck\ SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\ -SET CPPCHECK_LIBRARY_ARGS=--library=avr.cfg --library=bento4.cfg --library=boost.cfg --library=bsd.cfg --library=cairo.cfg --library=cppunit.cfg --library=dpdk.cfg --library=embedded_sql.cfg --library=gnu.cfg --library=googletest.cfg --library=gtk.cfg --library=kde.cfg --library=libcerror.cfg --library=libcurl.cfg --library=libsigc++.cfg --library=lua.cfg --library=mfc.cfg--library=microsoft_atl.cfg --library=microsoft_sal.cfg --library=microsoft_unittest.cfg --library=motif.cfg --library=nspr.cfg --library=opencv2.cfg --library=opengl.cfg --library=openmp.cfg --library=openssl.cfg --library=posix.cfg --library=python.cfg --library=qt.cfg --library=ruby.cfg --library=sdl.cfg --library=sfml.cfg --library=sqlite3.cfg --library=std.cfg --library=tinyxml2.cfg --library=vcl.cfg --library=windows.cfg --library=wxwidgets.cfg --library=zlib.cfg +SET CPPCHECK_LIBRARY_ARGS=--library=avr.cfg --library=bento4.cfg --library=boost.cfg --library=bsd.cfg --library=cairo.cfg --library=cppunit.cfg --library=dpdk.cfg --library=embedded_sql.cfg --library=gnu.cfg --library=googletest.cfg --library=gtk.cfg --library=kde.cfg --library=libcerror.cfg --library=libcurl.cfg --library=libsigc++.cfg --library=lua.cfg --library=mfc.cfg --library=microsoft_atl.cfg --library=microsoft_sal.cfg --library=microsoft_unittest.cfg --library=motif.cfg --library=nspr.cfg --library=opencv2.cfg --library=opengl.cfg --library=openmp.cfg --library=openssl.cfg --library=posix.cfg --library=python.cfg --library=qt.cfg --library=ruby.cfg --library=sdl.cfg --library=sfml.cfg --library=sqlite3.cfg --library=std.cfg --library=tinyxml2.cfg --library=vcl.cfg --library=windows.cfg --library=wxwidgets.cfg --library=zlib.cfg rem download cwec_latest.xml.zip and extract it to unzip cwec_vx.y.xml rem wget https://cwe.mitre.org/data/xml/cwec_latest.xml.zip --output-document=cwec_latest.xml.zip && unzip -j -o cwec_latest.xml.zip @@ -16,7 +16,7 @@ ECHO create Cppcheck errorlist cppcheck-errorlist.xml... "%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 > cppcheck-errorlist.xml ECHO create SonarQube rules file cppcheck.xml... -"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.6.xml > cppcheck.xml +"%CPPCHECK_DIR%cppcheck.exe" %CPPCHECK_LIBRARY_ARGS% --errorlist --xml-version=2 | "%PYTHON_DIR%python.exe" cppcheck_createrules.py rules cwec_v4.9.xml > cppcheck.xml ECHO create cppcheck-comparison.md... "%PYTHON_DIR%python.exe" utils_createrules.py comparerules "%SCRIPT_DIR%\..\main\resources\cppcheck.xml" .\cppcheck.xml > cppcheck-comparison.md