PVS-Studio 7.10 Release: OWASP, AUTOSAR, SARIF
We develop PVS-Studio not only as a classic code analyzer, but also in the direction of Security and Safety. In this regard, we've started working on the support of the OWASP and AUTOSAR C++14 standards. To facilitate PVS-Studio integration into other code quality control tools, we supported analyzer results conversion to the SARIF format. Implemented 22 new diagnostics for C, C++, C#, and Java. You will learn more about these and other new features in this press release.
While the world is fighting against viruses, we are tackling bugs and potential vulnerabilities. To make the fight more effective, we've been developing the following directions for this PVS-Studio release:
- security (SAST);
- new diagnostics.
The PVS-Studio analyzer is a SAST (Static Application Security Testing) tool that helps identify potential vulnerabilities and zero-day threats. For the convenience of security specialists, we have long classified PVS-Studio warnings according to the CWE list and the SEI CERT standard.
The next step was to support the OWASP ASVS standard. We still have work to do to better support detection of potential vulnerability patterns described in OWASP. However, starting with PVS-Studio 7.10, you can already get acquainted with the OWASP diagnostics mapping table. The table is not that extended so far, but it will be gradually updated.
Standards such as MISRA C and MISRA C++ are used to ensure the quality and reliability of software. They are most often used when developing software for embedded devices. You can read more about these standards in the article "What Is MISRA and how to Cook IT".
However, the MISRA C++ standard is already quite deprecated and is not meant for modern versions of the C++ programming language. Therefore, it is replaced by the AUTOSAR C++14 Coding Guidelines.
In addition to MISRA, we decided to start supporting this newer standard. The first work in this direction was carried out for PVS-Studio 7.10. The mapping table for PVS-Studio and AUTOSAR warnings is available here. As with other standards, we will gradually expand support of the AUTOSAR standard.
Utilities for converting PVS-Studio analysis results (PlogConverter.exe for Windows and plog-converter for Linux\macOS) now support conversion to SARIF (Static Analysis Results Interchange Format).
SARIF is a universal open format for presenting the results of tools that search for errors, safety and security defects. This format is supported by many static analyzers and allows you to combine various code quality control tools in a single ecosystem.
Support of handling analysis results when checking projects for Unreal Engine is added in the PVS-Studio plugin for JetBrains Rider (JetBrains Rider for Unreal Engine is now available under the early access program).
SonarQube PVS-Studio plugin can now associate analyzer messages that have a CWE (Common Weakness Enumeration) identifier with messages about security defects in the Security Category tab.
- V830. Decreased performance. Consider replacing the use of 'std::optional::value()' with either the '*' or '->' operator.
- V831. Decreased performance. Consider replacing the call to the 'at()' method with the 'operator'.
- V1064. The left operand of integer division is less than the right one. The result will always be zero.
- V1065. Expression can be simplified: check similar operands.
- V1066. The 'SysFreeString' function should be called only for objects of the 'BSTR' type.
- V1067. Throwing from exception constructor may lead to unexpected behavior.
- V3156. The argument of the method is not expected to be null.
- V3157. Suspicious division. Absolute value of the left operand is less than the right operand.
- V3158. Suspicious division. Absolute values of both operands are equal.
- V3159. Modified value of the operand is not used after the increment/decrement operation.
- V3160. Argument of incorrect type is passed to the 'Enum.HasFlag' method.
- V3161. Comparing value type variables with 'ReferenceEquals' is incorrect because compared values will be boxed.
- V3162. Suspicious return of an always empty collection.
- V3163. An exception handling block does not contain any code.
- V3164. Exception classes should be publicly accessible.
- V6093. Automatic unboxing of a variable may cause NullPointerException.
- V6094. The expression was implicitly cast from integer type to real type. Consider utilizing an explicit type cast to avoid the loss of a fractional part.
- V6095. Thread.sleep() inside synchronized block/method may cause decreased performance.
- V6096. An odd precise comparison. Consider using a comparison with defined precision: Math.abs(A - B) < Epsilon or Math.abs(A - B) > Epsilon.
- V6097. Lowercase 'L' at the end of a long literal can be mistaken for '1'.
- V6098. A method does not override another method from the base class.
- V6099. The initial value of the index in the nested loop equals 'i'. Consider using 'i + 1' instead.
Mapping tables of PVS-Studio diagnostics to different standards:
Recent posts in our blog that I'd like to draw your attention to: