Pull to refresh
205.36
PVS-Studio
Static Code Analysis for C, C++, C# and Java
Show first

Best Copy-Paste Algorithms for C and C++. Haiku OS Cookbook

Reading time14 min
Views1.1K
Numerous typos and Copy-Paste code became the main topic of the additional article about checking the Haiku code by the PVS-Studio analyzer. Yet this article mostly tells about errors related to thoughtlessness and failed refactoring, rather than to typos. The errors found demonstrate how strong the human factor is in software development.

Picture 1
Read more →
Total votes 16: ↑13 and ↓3+10
Comments0

How to shoot yourself in the foot in C and C++. Haiku OS Cookbook

Reading time20 min
Views3K
The story of how the PVS-Studio static analyzer and the Haiku OS code met goes back to the year 2015. It was an exciting experiment and useful experience for teams of both projects. Why the experiment? At that moment, we didn't have the analyzer for Linux and we wouldn't have it for another year and a half. Anyway, efforts of enthusiasts from our team have been rewarded: we got acquainted with Haiku developers and increased the code quality, widened our error base with rare bugs made by developers and refined the analyzer. Now you can check the Haiku code for errors easily and quickly.
Picture 1

Read more →
Total votes 18: ↑17 and ↓1+16
Comments1

What's the Use of Dynamic Analysis When You Have Static Analysis?

Reading time6 min
Views2.8K
In order to verify the quality of software, you have to use a lot of different tools, including static and dynamic analyzers. In this article, we'll try to figure out why only one type of analysis, whether static or dynamic, may not be enough for comprehensive software analysis and why it's preferable to use both.

Рисунок 1

Read more →
Total votes 21: ↑19 and ↓2+17
Comments0

Errors that static code analysis does not find because it is not used

Reading time5 min
Views1.8K
Readers of our articles occasionally note that the PVS-Studio static code analyzer detects a large number of errors that are insignificant and don't affect the application. It is really so. For the most part, important bugs have already been fixed due to manual testing, user feedback, and other expensive methods. At the same time, many of these errors could have been found at the code writing stage and corrected with minimal loss of time, reputation and money. This article will provide several examples of real errors, which could have been immediately fixed, if project authors had used static code analysis.

Read more →
Total votes 22: ↑21 and ↓1+20
Comments0

PVS-Studio wanted but couldn't find bugs in robots.txt

Reading time3 min
Views2.1K
Picture 1

The other day Google revealed the sources of the robots.txt parser. Why not give a run for the already far and wide checked project using PVS-Studio and possibly find a bug. So said so done. But I wish we could find something meaningful. Well, then let it be just a reason to give full marks for Google developers.

robots.txt — is an index file that contains rules for search robots. It works for https, http and FTP protocols. Google made the parser of the robots.txt file available for everyone. Read more about this news here: Google opens the source code of the robots.txt parser
Read more →
Total votes 22: ↑20 and ↓2+18
Comments2

PVS-Studio for Visual Studio

Reading time10 min
Views1.1K


Many of our articles are focused on anything, but not the PVS-Studio tool itself. Whereas we do a lot to make its usage convenient for developers. Nevertheless, our efforts are often concealed behind the scenes. I decided to remedy this situation and tell you about the PVS-Studio plugin for Visual Studio. If you use Visual Studio, this article is for you.
Read more →
Total votes 18: ↑18 and ↓0+18
Comments0

The dangers of using multi-character constants

Reading time2 min
Views1.3K

Picture 1

During code analysis, PVS-Studio analyzes the data flow and operates variable values. Values are taken from constants or derived from conditional expressions. We call them virtual values. Recently, we have refined them in order to work with multi-character constants and this has become the reason to create a new diagnostic rule.

Introduction


Multi-character-literals are implementation-defined, so different compilers can encode them in different ways. For example, GCC and Clang set a value, based on the order of the symbols in the literal, while MSVC moves them depending on the symbol's type (regular or escape).
Read more →
Total votes 16: ↑15 and ↓1+14
Comments0

How to quickly check out interesting warnings given by the PVS-Studio analyzer for C and C++ code?

Reading time5 min
Views992

Once in a while, programmers who start getting acquainted with the PVS-Studio code analyzer ask me: «Is there a list of warnings that accurately indicate errors?» There is no such list because uninteresting (false) warnings in one project are very important and useful in another one. However, one can definitely start digging into the analyzer from the most exciting warnings. Let's take a closer look at this topic.
Read more →
Total votes 22: ↑22 and ↓0+22
Comments0

PVS-Studio Graph of Diagnostic Abilities Development

Reading time2 min
Views768
Maturation

More than 8 years have passed since the PVS-Studio product was released, and all this time we've been implementing new diagnostic rules in it. Moreover, we are not going to stop. If you care about whether we have lost our vivacity over the years, and whether PVS-Studio stops developing, the graph given in the article will take this issue off the table. The analyzer is actively developing, and the speed of development only increases over the years.
Read more →
Total votes 26: ↑26 and ↓0+26
Comments0

Nullable Reference types in C# 8.0 and static analysis

Reading time12 min
Views3.6K

Picture 9


It's not a secret that Microsoft has been working on the 8-th version of C# language for quite a while. The new language version (C# 8.0) is already available in the recent release of Visual Studio 2019, but it's still in beta. This new version is going to have a few features implemented in a somewhat non-obvious, or rather unexpected, way. Nullable Reference types are one of them. This feature is announced as a means to fight Null Reference Exceptions (NRE).
Read more →
Total votes 19: ↑18 and ↓1+17
Comments1

Support of Visual Studio 2019 in PVS-Studio

Reading time19 min
Views1K


Support of Visual Studio 2019 in PVS-Studio affected a number of components: the plugin itself, the command-line analyzer, the cores of the C++ and C# analyzers, and a few utilities. In this article, I will briefly explain what problems we encountered when implementing support of the IDE and how we addressed them.
Read more →
Total votes 31: ↑30 and ↓1+29
Comments0

Cataclysm Dark Days Ahead: Static Analysis and Roguelike Games

Reading time10 min
Views4.6K
Picture 5

You must have already guessed from the title that today's article will be focusing on bugs in software source code. But not only that. If you are not only interested in C++ and in reading about bugs in other developers' code but also dig unusual video games and wonder what «roguelikes» are and how you play them, then welcome to read on!
Read more →
Total votes 25: ↑25 and ↓0+25
Comments0

IntelliJ IDEA, ReSharper, SonarLint and SonarQube find the same errors, as PVS-Studio — so why do we need PVS-Studio?

Reading time2 min
Views1.9K
Sometimes people ask the question, which addresses a certain topic but is actually about another thing. As the saying goes, a competently asked question contains half the answer.

Recently I've returned from the JPoint conference, where we first presented our new PVS-Studio analyzer for Java. Interest in static analysis is growing strongly in the last few years, so the audience perceived PVS-Studio enthusiastically. In addition to the positive feedback, as it happens, we had to handle objections. The most frequent objection to the suggestion to try PVS-Studio sounds something like this: «C'mon, why do we try PVS-Studio? We use IntelliJ IDEA, ReSharper, SonarLint and SonarQube. We've run PVS-Studio recently and it found errors, already highlighted by IntelliJ IDEA!»

I just can't help but write a small reply note to this comment. I even have two responses to this objection. And yes, I intentionally stated ReSharper, as there are some questions to our C# analyzer as well. Well, here comes the answer.
Read more →
Total votes 24: ↑23 and ↓1+22
Comments0

Analyzing the Code of CUBA Platform with PVS-Studio

Reading time14 min
Views994

Java developers have access to a number of useful tools that help to write high-quality code such as the powerful IDE IntelliJ IDEA, free analyzers SpotBugs, PMD, and the like. The developers working on CUBA Platform have already been using all of these, and this review will show how the project can benefit even more from the use of the static code analyzer PVS-Studio.
Read more →
Total votes 22: ↑22 and ↓0+22
Comments0

Wireshark 3.x: code analysis under macOS and errors review

Reading time9 min
Views1.9K

Picture 1

Wireshark Foundation released the final stable-version of the popular network traffic analyzer — Wireshark 3.0.0. The new release fixes several bugs, it is now possible to analyze the new protocols, apart from that the driver on Npcap WinPcap is replaced. Here is where quoting of the announcement ends and our note about bugs in the project starts off. The projects authors definitely haven't done their best in fixing bugs before the release.

Let's collect hotfixes right now to give a motive in doing a new release :).

Introduction


Wireshark is a well-known tool to capture and analyze network traffic. The program works with the vast majority of known protocols, has intuitive and logical graphical interface, an all-powerful system of filters. Wireshark is cross-platform, works in such OSs, as: Windows, Linux, macOS, Solaris, FreeBSD, NetBSD and many others.

To do the source code analysis, we used PVS-Studio static code analyzer. To analyze the source code, first we needed to compile the project in an OS. The choice was wide not only due to the cross platform nature of the project, but also because of that of the analyzer. I chose macOS for the analysis. You can also run the analyzer under Windows and Linux.
Read more →
Total votes 24: ↑24 and ↓0+24
Comments0

Information

Website
pvs-studio.com
Registered
Founded
2008
Employees
31–50 employees