Pour obtenir une clé
d'essai remplissez le formulaire ci-dessous
Demandez des tariffs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
RUB
* En cliquant sur ce bouton, vous acceptez notre politique de confidentialité

Free PVS-Studio license for Microsoft MVP specialists
To get the licence for your open-source project, please fill out this form
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

I am interested to try it on the platforms:
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

Votre message a été envoyé.

Nous vous répondrons à


Si vous n'avez toujours pas reçu de réponse, vérifiez votre dossier
Spam/Junk et cliquez sur le bouton "Not Spam".
De cette façon, vous ne manquerez la réponse de notre équipe.

>
>
>
Examples of errors detected by the V649…

Examples of errors detected by the V649 diagnostic

V649. Two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless.


RunAsAdmin Explorer Shim

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 67, 70. cannonical_xml.h 70


class xmlInputCharData {
public:
  static bool isBaseChar(wchar_t l) {
    ....
    if (l >= 0x06BA && l <= 0x06BE) return true;
    if (l >= 0x06C0 && l <= 0x06CE) return true;
    if (l >= 0x06D0 && l <= 0x06D3) return true;
    if (l == 0x06D5) return true;                  // <=
    if (l >= 0x06E5 && l <= 0x06E6) return true;
    if (l >= 0x0905 && l <= 0x0939) return true;
    if (l == 0x06D5) return true;                  // <=
    if (l >= 0x0958 && l <= 0x0961) return true;
    if (l >= 0x0985 && l <= 0x098C) return true;
    if (l >= 0x098F && l <= 0x0990) return true;
    ....
  }

Miranda IM

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 693, 696. cluiframes.c 696


int CLUIFramesGetalClientFrame(void)
{
  int i;

  if(alclientFrame!=-1)
    return alclientFrame;

  if(alclientFrame!=-1)
  {
    /* this value could become invalid if RemoveItemFromList
     * was called, so we double-check */
    ....
  }
}

Similar errors can be found in some other places:

  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 147, 148. init.c 148
  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 909, 915. icq_direct.cpp 915
  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 343, 347. jabber_rc.cpp 347

Wolfenstein 3D

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 243, 262. tr_animation.c 262


#define REFLAG_FULL_LOD     8   // force a FULL lod
#define REFLAG_FORCE_LOD    8   // force a low lod

float R_CalcMDSLod(....)
{
  ....
  if ( refent->reFlags & REFLAG_FULL_LOD )
  {
    return 1.0f;
  }
  ....
  if ( refent->reFlags & REFLAG_FORCE_LOD )
  {
    flod *= 0.5;
  }
  ....
}

Coin3D

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1205, 1206. sbprofilingdata.cpp 1206


int
SbProfilingData::operator == (const SbProfilingData & rhs) const
{
  if (this->actionType != rhs.actionType) return FALSE;
  if (this->actionStartTime != rhs.actionStopTime) return FALSE;
  if (this->actionStartTime != rhs.actionStopTime) return FALSE;
  ....
}

Micro-Manager

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 2918, 2922. LeicaDMI.cpp 2922


int AFC::Initialize()
{
  int ret = DEVICE_OK;
  ....
  if (ret != DEVICE_OK)
    return ret;
  AddAllowedValue("DichroicMirrorIn", "0", 0);
  AddAllowedValue("DichroicMirrorIn", "1", 1);
  if (ret != DEVICE_OK)
    return ret;
  ....
}

Not terrible, but second if() does not make sense.

Similar errors can be found in some other places:

  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 192, 198. AAAOTF.cpp 198
  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 507, 513. AAAOTF.cpp 513
  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1060, 1073. LeicaDMI.cpp 1073
  • And 12 additional diagnostic messages.

Blender

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1672, 1675. writeffmpeg.c 1675


bool BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd)
{
    int codec = rd->ffcodecdata.codec;
    if (codec == AV_CODEC_ID_QTRLE)
        return true;
    if (codec == AV_CODEC_ID_PNG)
        return true;
    if (codec == AV_CODEC_ID_PNG)
        return true;
    ....
}

Blender

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 331, 332. writefile.c 332


static void writedata_do_write(....)
{
  if ((wd == NULL) || wd->error ||
      (mem == NULL) || memlen < 1) return;
  if (wd->error) return;
  ....
}

LLVM/Clang

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 4410, 4413. MachODump.cpp 4413


static bool print_class_ro64_t(....) {
  ....
  const char *r;
  uint32_t offset, xoffset, left;
  ....
  r = get_pointer_64(p, offset, left, S, info);
  if (r == nullptr || left < sizeof(struct class_ro64_t))   // <=
    return false;                                           // <=
  memset(&cro, '\0', sizeof(struct class_ro64_t));
  if (left < sizeof(struct class_ro64_t)) {                 // <=
    memcpy(&cro, r, left);
    outs() << "   (class_ro_t entends past the .......)\n";
  } else
    memcpy(&cro, r, sizeof(struct class_ro64_t));
  ....
}

EFL Core Libraries

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 2282, 2285. ecore_con.c 2285


static Eina_Bool
_ecore_con_cl_handler(void *data,
                      Ecore_Fd_Handler *fd_handler)
{
   Ecore_Con_Server *obj = data;
   Eina_Bool want_read, want_write;
   Ecore_Con_Server_Data *svr =
     eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);

   if (svr->delete_me)
     return ECORE_CALLBACK_RENEW;

   if (svr->delete_me)
     return ECORE_CALLBACK_RENEW;
  ....
}

Chromium

V649 CWE-561 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 67, 71. tsf_input_scope.cc 71


STDMETHOD(GetInputScopes)(InputScope** input_scopes,
                          UINT* count) override
{
  if (!count || !input_scopes)
    return E_INVALIDARG;
  *input_scopes = static_cast<InputScope*>(CoTaskMemAlloc(
      sizeof(InputScope) * input_scopes_.size()));
  if (!input_scopes) {
    *count = 0;
    return E_OUTOFMEMORY;
  }
  ....
}

Most likely, a developer forgot to dereference a pointer and the code should actually look like this: if (!*input_scopes) {


Skia Graphics Engine

V649 CWE-561 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 758, 761. skpathref.cpp 761


bool SkPathRef::isValid() const {
  ....
  if (nullptr == fPoints && 0 != fFreeSpace) {
    return false;
  }
  if (nullptr == fPoints && 0 != fFreeSpace) {
    return false;
  }
  ....
}

The same check is performed twice. Or the second check is redundant. Or one forgot to check out something else.


LibreOffice

V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 125, 137. acctable.cxx 137


STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
{
    SolarMutexGuard g;

    ENTER_PROTECTED_BLOCK

    // #CHECK#
    if(description == nullptr)
        return E_INVALIDARG;

    // #CHECK XInterface#
    if(!pRXTable.is())
        return E_FAIL;
    ....
    SAFE_SYSFREESTRING(*description);
    *description = SysAllocString(o3tl::toW(ouStr.getStr()));
    if(description==nullptr) // <=
        return E_FAIL;
    return S_OK;

    LEAVE_PROTECTED_BLOCK
}

Similar errors can be found in some other places:

  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 344, 356. acctable.cxx 356
  • V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 213, 219. trvlfrm.cxx 219

Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter