To get a trial key
fill out the form below
Team License (standard version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Program Errors That Do Not Exist

Program Errors That Do Not Exist

Dec 24 2009
Author:

Not long ago, one user of our code analyzer PVS-Studio addressed us; he was complaining about the work of the tool during the verification of one of his projects.

Our tool gave out such a message:

Error 155 Cannot open configuration file c:\foo\testfile.c.PVS
  Studio.cfg

We should explain hereby that for each file being verified, PVS-Studio creates, among others, a special configuration file PVS-Studio.cfg, in which the selected settings are given for the analysis module (which is a separate exe-file).

In the process of correspondence, it turned out that the file which the tool cannot check, is called not testfile.c, as it should be by the logic of the message, but test^file.c. Such behavior looks as if the analyzer lost the symbol "^". Trying to find the error, we have detected that the plug-in PVS-Studio transfers the file name correctly, while the problem occurs in fact in the analyzer core (the separate exe-file itself).

First, we seemed to find that the problem with this symbol is "nearby" the parsing library of configuration files. However, strange things turned out during the debugging. If one sets command line parameters in Visual Studio environment (in which we develop the tool) for the analyzer as "-cfg=c:\foo\test^file.c.PVS-Studio.cfg" and presses Ctrl-F5 (program start), one will get a message:

Cannot open configuration file c:\foo\testfile.c.PVS-Studio.cfg

That means that the error repeats.

And if one presses F5 only (debugger start), then the program will work correctly! The reader will say at once: "So why do you develop a tool for a developer and do not know yourself that the Debug-version of the program can work, while the Release version cannot?" Please pay attention that both in the first and second cases Debug-version was started, but in different modes.

After the experiments it became obvious that nothing was obvious.

We put the code of our project aside and carried out a simple experiment that can be repeated by anyone.

  • 1. Open Visual Studio 2005 or 2008 (there is no difference), create Visual C++ Win32 Console Application.
  • 2. Insert only one line with fprintf the way the following code is obtained as a result:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
  fprintf(stdout, "%s\n", argv[1]);
  return 0;
}
  • 3. In the debug settings (Debugging->Command Arguments) indicate "test^file.c" without quotation marks.
  • 4. Start the program (Debug mode) by Ctrl-F5. We get:
testfile.c

i.e., symbol "^" has disappeared

  • 5. Put a breakpoint in the line "return 0;", press F5. We get:
test^file.c

i.e., symbol "^" exists.

Strange as it may seem, the program behaves differently depending on the start mode. Probably, symbol "^" is processed as an Escape-sequence. But why start by F5 and Ctrl-F5 gives different results?

In PVS-Studio, we selected an alternate way. In case in the configuration file name there appears symbol "^", we replace it by another symbol.

Popular related articles
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept