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.
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.

>
>
Examples of errors detected by the V559…

Examples of errors detected by the V559 diagnostic

April 5, 2021

V559. Suspicious assignment inside the conditional expression of 'if/while/for' statement.


Miranda IM

V559 Suspicious assignment inside the condition expression of 'if' operator: ret = 0. clist_mw clcidents.c 179


int FindItem(....)
{
  ....
  int ret;
  ret=FindItem(hwnd,dat,hItem,
               (struct ClcContact ** )&z,
               (struct  ClcGroup** )&isv,NULL);
  if (ret=0) {return (0);}
  ....
}

This is what should have been written here: if (ret==0) {return (0);}


Miranda IM

V559 Suspicious assignment inside the condition expression of 'if' operator: Drawing->type = 1. clist_mw clcpaint.c 548


void InternalPaintClc(HWND hwnd,struct ClcData *dat,
                      HDC hdc,RECT *rcPaint)
{
  ....
  if (Drawing->type=CLCIT_CONTACT)
  ....
}

Miranda IM

V559 Suspicious assignment inside the condition expression of 'if' operator: ft->ft_magic = 0x4F. icqoscar8 icq_proto.cpp 666


int __cdecl CIcqProto::FileCancel( ... )
{
  ....
  if (dwUin && ft->ft_magic == FT_MAGIC_ICQ)
  {
    ....
  }
  else if (ft->ft_magic = FT_MAGIC_OSCAR)
  {
    ....
  }
  ....
}

This is what should have been written here: else if (ft->ft_magic == FT_MAGIC_OSCAR)


Intel AMT SDK

V559 Suspicious assignment inside the condition expression of 'if' operator: status = true. AgentPresenceAPIConsole agentpresenceapiconsole.cpp 530


bool SetCBPolicy(....)
{
  ....
  if(status = true)
  {
    PrintSuccess();
  }

  return status;
}

This is what should have been written here: if(status == true)

Similar errors can be found in some other places:

  • V559 Suspicious assignment inside the condition expression of 'if' operator: status = true. CircuitBreaker circuitbreakersample.cpp 1637

Data Distribution Service

V559 Suspicious assignment inside the condition expression of 'if' operator: dsqp.service_cleanup_delay.sec = 4. ut_parameterlistconverter.cpp 1295


int
ACE_TMAIN(int, ACE_TCHAR*[])
{
  ....
  TEST_ASSERT(dsqp.service_cleanup_delay.sec = 4);
  TEST_ASSERT(dsqp.service_cleanup_delay.nanosec = 2000);
  TEST_ASSERT(dsqp.history_kind == KEEP_LAST_HISTORY_QOS);
  TEST_ASSERT(dsqp.history_depth == 172);
  TEST_ASSERT(dsqp.max_samples == 389);
  TEST_ASSERT(dsqp.max_instances == 102);
  TEST_ASSERT(dsqp.max_samples_per_instance == 20);
  ....
}

Similar errors can be found in some other places:

  • V559 Suspicious assignment inside the condition expression of 'if' operator. ut_parameterlistconverter.cpp 1296

Scilab

V559 Suspicious assignment inside the condition expression of 'if' operator: status = 1. set_view_property.c 61


int set_view_property(....)
{
  BOOL status = FALSE;
  ....
  status = setGraphicObjectProperty(
    pobjUID, __GO_VIEW__, &viewType, jni_int, 1);

  if (status = TRUE)
  {
    return SET_PROPERTY_SUCCEED;
  }
  else
  {
    Scierror(999, _("'%s' property does not exist ")
      _("for this handle.\n"), "view");
    return  SET_PROPERTY_ERROR ;
  }
  ....
}

Miranda NG

V559 Suspicious assignment inside the condition expression of 'if' operator: k = 15. NimContact contactinfo.cpp 339


#define MAX_REPLACES 15

INT_PTR CALLBACK DlgProcCopy(....)
{
  ....
  if (string == newString[k])
    k--;
  if (k = MAX_REPLACES) break;
  string = oldString[++k];
  i+=2;
  ....
}

Miranda NG

V559 Suspicious assignment inside the condition expression of 'if' operator: Order = - - 1. NewAwaySys msgtree.cpp 677


CBaseTreeItem* CMsgTree::GetNextItem(....)
{
  ....
  int Order = TreeCtrl->hItemToOrder(TreeView_GetNextItem(....));
  if (Order =- -1)
    return NULL;
  ....
}

The GTK+ Project

V559 Suspicious assignment inside the condition expression of 'if' operator. gdkselection-x11.c 741


gboolean
gdk_x11_display_utf8_to_compound_text (....)
{
  ....
  GError *error = NULL;
  ....
  if (!(error->domain = G_CONVERT_ERROR &&
        error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
  ....
}

Serious Engine 1 v.1.10

V559 Suspicious assignment inside the condition expression of 'if' operator: pwndView = 0. mainfrm.cpp 697


void CMainFrame::OnCancelMode()
{
  // switches out of eventual direct screen mode
  CWorldEditorView *pwndView = (....)GetActiveView();
  if (pwndView = NULL) {                             // <=
    // get the MDIChildFrame of active window
    CChildFrame *pfrChild = (....)pwndView->GetParentFrame();
    ASSERT(pfrChild!=NULL);
  }
  CMDIFrameWnd::OnCancelMode();
}

Similar errors can be found in some other places:

  • V559 Suspicious assignment inside the condition expression of 'if' operator: pwndView = 0. mainfrm.cpp 710

Serious Engine 1 v.1.10

V559 Suspicious assignment inside the condition expression of 'if' operator: _strModURLSelected = "". menu.cpp 1188


CTString _strModURLSelected;

void JoinNetworkGame(void)
{
  ....
  char strModURL[256] = {0};
  _pNetwork->ga_strRequiredMod.ScanF(...., &strModURL);
  _fnmModSelected = CTString(strModName);
  _strModURLSelected = strModURL; // <=
  if (_strModURLSelected="") {    // <=
    _strModURLSelected = "http://www.croteam.com/mods/Old";
  }
  ....
}

Popular related articles
PVS-Studio for Java

Date: 01.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…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: 07.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…
The way static analyzers fight against false positives, and why they do it

Date: 03.20.2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Free PVS-Studio for those who develops open source projects

Date: 12.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 Evil within the Comparison Functions

Date: 05.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: 10.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…
The Ultimate Question of Programming, Refactoring, and Everything

Date: 04.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…
Static analysis as part of the development process in Unreal Engine

Date: 06.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…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: 10.22.2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
The Last Line Effect

Date: 05.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…

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