Examples of errors detected by the V600 diagnostic.


V600. Consider inspecting the condition. The 'Foo' pointer is always not equal to NULL.


Notepad++

V600 Consider inspecting the condition. The 'headerM' pointer is always not equal to NULL. notepadPlus printer.cpp 378


size_t Printer::doPrint(bool justDoIt)
{
  ...
  TCHAR headerM[headerSize] = TEXT("");
  ...
  if (headerM != '\0')
  {
  ...
}

Similar errors can be found in some other places:

  • V600 Consider inspecting the condition. The 'headerR' pointer is always not equal to NULL. notepadPlus printer.cpp 390

Notepad++

V600 Consider inspecting the condition. The 'mainVerStr' pointer is always not equal to NULL. Notepad++ nppbigswitch.cpp 938

V600 Consider inspecting the condition. The 'auxVerStr' pointer is always not equal to NULL. Notepad++ nppbigswitch.cpp 940


LRESULT Notepad_plus::process(
  HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
  ...
  TCHAR mainVerStr[16];
  TCHAR auxVerStr[16];
  ...
  if (mainVerStr)
    mainVer = generic_atoi(mainVerStr);
  if (auxVerStr)
    auxVer = generic_atoi(auxVerStr);
  ...
}

Unnecessary checks.

Similar errors can be found in some other places:

  • V600 Consider inspecting the condition. The 'intStr' pointer is always not equal to NULL. Notepad++ preferencedlg.cpp 1871
  • V600 Consider inspecting the condition. The 'intStr' pointer is always not equal to NULL. Notepad++ userdefinedialog.cpp 222
  • V600 Consider inspecting the condition. The 'intStr' pointer is always not equal to NULL. Notepad++ wordstyledlg.cpp 539

OpenSSL

V600 Consider inspecting the condition. The 'dsa_c[i]' pointer is always not equal to NULL. speed.c 1486


int MAIN(int argc, char **argv)
{
  ....
  long dsa_c[DSA_NUM][2];
  ....
  if (dsa_c[i] == 0)
  {
    dsa_c[i][0]=1;
    dsa_c[i][1]=1;
  }
  ....
}

Most likely this is what should be written here: (dsa_c[i][0] == 0).

Similar errors can be found in some other places:

  • V600 Consider inspecting the condition. The 'ecdsa_c[i]' pointer is always not equal to NULL. speed.c 1506
  • V600 Consider inspecting the condition. The 'ecdsa_c[i]' pointer is always not equal to NULL. speed.c 1523
  • V600 Consider inspecting the condition. The 'ecdsa_c[i]' pointer is always not equal to NULL. speed.c 1540
  • And 3 additional diagnostic messages.

Multi Theft Auto

V600 Consider inspecting the condition. The 'szSerial' pointer is always not equal to NULL. cluafunctiondefs.player.cpp 508


int CLuaFunctionDefs::GetPlayerSerial ( lua_State* luaVM )
{
  char szSerial [ 64 ];
  g_pCore->GetNetwork()->GetSerial(szSerial, sizeof(szSerial));

  if ( szSerial )
  {
    lua_pushstring ( luaVM, szSerial );
    return 1;
  }

  lua_pushboolean ( luaVM, false );
  return 1;
}

Firebird

V600 Consider inspecting the condition. The 'dbb_file->fil_string' pointer is always not equal to NULL. sdw.cpp 961


class jrd_file : public pool_alloc_rpt<SCHAR, type_fil>
{
  ....
  SCHAR fil_string[1];
}

void SDW_start(....)
{
  ....
  if (dbb_file && dbb_file->fil_string &&
      expanded_name == dbb_file->fil_string)
  ....
}

ITK

V600 Consider inspecting the condition. The 'process_id' pointer is always not equal to NULL. itkmultithreaderwinthreads.cxx 90


void MultiThreader::MultipleMethodExecute()
{
  ....
  HANDLE process_id[ITK_MAX_THREADS];
  ....
  process_id[thread_loop] = (void *) _beginthreadex(0, 0, ....);

  if ( process_id == 0 )
  {
    itkExceptionMacro("Error in thread creation !!!");
  }
  ....
}

Most likely this is what should be written here: if ( process_id[thread_loop] == 0 )


FreeSWITCH

V600 Consider inspecting the condition. The 'name' pointer is always not equal to NULL. fsodbc.cpp 323


JS_ODBC_FUNCTION_IMPL(GetData)
{
  ....
  SQLCHAR name[1024] = "";                                  // <=
  SQLCHAR *data = _colbuf;
  SQLLEN pcbValue;

  SQLDescribeCol(_stmt, x, name, sizeof(name), ....);       // <=
  SQLGetData(_stmt, x, SQL_C_CHAR, _colbuf, _cblen, &pcbValue);

  if (name) {                                               // <=
    if (SQL_NULL_DATA == pcbValue) {
      arg->Set(String::NewFromUtf8(GetIsolate(),
        (const char *)name), Null(info.GetIsolate()));
    } else {
      arg->Set(String::NewFromUtf8(GetIsolate(),
        (const char *)name), String::NewFromUtf8(GetIsolate(),
        data ? (const char *)data : ""));
    }
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show again