Примеры ошибок, обнаруженных с помощью диагностики V637


V637. Two opposite conditions were encountered. The second condition is always false.


OpenCV

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 195, 197. keypoint.cpp 195


void KeyPointsFilter::retainBest(
  vector<KeyPoint>& keypoints, int n_points)
{
  ....
  if( n_points > 0 && keypoints.size() > (size_t)n_points )
  {
    if (n_points==0)
    {
      keypoints.clear();
      return;
    }
  ....
}

Chromium

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 500, 501. web_request_api_helpers.cc 500


static void ParseRequestCookieLine(
    const std::string& header_value,
    ParsedRequestCookies* parsed_cookies)
{
  std::string::const_iterator i = header_value.begin();
  ....
  if (*i == '"') {
    while (i != header_value.end() && *i != '"') ++i;
  ....
}

TinyCAD

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 86, 90. paint.cpp 86


void CTinyCadView::OnDraw(CDC* pDC)
{
  ....
  // Is any of this region in the off-page area?
  if (!pDC->IsPrinting())
  {
    // Paint the region white
    if (pDC->IsPrinting())
    {
      dc.SelectBrush(cWHITE);
      dc.SelectPen(PS_SOLID, 1, cWHITE);
    }
  ....
}

VirtualDub

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 183, 184. VirtualDub backface.cpp 183


void VDBackfaceService::Execute(
  IVDBackfaceStream& out, char *s)
{
  ....
  if (*s == '"') {
    while(*s && *s != '"')
      ++s;
  } else {
  ....
}

Unreal Engine 4

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 310, 312. propertystruct.cpp 310


const TCHAR* UStructProperty::ImportText_Internal(....) const
{
  ....
  if (*Buffer == TCHAR('\"'))                     // <=
  {
    while (*Buffer &&
           *Buffer != TCHAR('\"') &&              // <=
           *Buffer != TCHAR('\n') &&
           *Buffer != TCHAR('\r'))
    {
      Buffer++;
    }

    if (*Buffer != TCHAR('\"'))
  ....
}

TortoiseGit

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 2464, 2466. TortoiseGitMerge mergeinfo.c 2464


svn_error_t *
svn_mergeinfo__adjust_mergeinfo_rangelists(....)
{
  ....
  if (range->start + offset > 0 && range->end + offset > 0)
  {
    if (range->start + offset < 0)
      range->start = 0;
    else
      range->start = range->start + offset;

    if (range->end + offset < 0)
      range->end = 0;
    else
      range->end = range->end + offset;
  ....
}

K Desktop Environment

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 410, 412. kebsearchline.cpp 410


void
KViewSearchLine::slotColumnsRemoved(const QModelIndex &,
                                    int first, int last)
{
  if(d->treeView)
    updateSearch();
  else
  {
    if(d->listView->modelColumn() >= first &&
       d->listView->modelColumn() <= last)
    {
      if(d->listView->modelColumn()>last)   // <=
        kFatal()<<"...."<<endl;
      updateSearch();
    }
  }
}

.NET CoreCLR

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 31825, 31827. cee_wks gc.cpp 31825


void gc_heap::verify_heap (BOOL begin_gc_p)
{
  ....
  if (brick_table [curr_brick] < 0)
  {
    if (brick_table [curr_brick] == 0)
    {
      dprintf(3, ("curr_brick %Ix for object %Ix set to 0",
              curr_brick, (size_t)curr_object));
      FATAL_GC_ERROR();
    }
    ....
  }
  ....
}

Similar errors can be found in some other places:

  • V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 2898, 2900. daccess nidump.cpp 2898
  • V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 337, 339. utilcode prettyprintsig.cpp 337
  • V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 774, 776. utilcode prettyprintsig.cpp 774

ReactOS

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 2532, 2535. devinst.c 2532


HDEVINFO WINAPI SetupDiGetClassDevsExW(....)
{
  ....
  if (flags & DIGCF_ALLCLASSES)
  {
    ....
  }
  else if (!IsEqualIID(&list->ClassGuid, &GUID_NULL))// <=
  {
    if (IsEqualIID(&list->ClassGuid, &GUID_NULL))    // <=
          pClassGuid = &list->ClassGuid;
    ....
  }
  ....
}

Firebird

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 778, 780. jrd.cpp 778


void Trigger::compile(thread_db* tdbb)
{
  SET_TDBB(tdbb);

  Database* dbb = tdbb->getDatabase();
  Jrd::Attachment* const att = tdbb->getAttachment();

  if (extTrigger)
    return;

  if (!statement /*&& !compile_in_progress*/)
  {
    if (statement)
      return;
    ....
  }
}

Blender

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 938, 939. editcurve_select.c 938


static int select_less_exec(....)
{
  ....
  if ((lastsel==0)&&(bp->hide==0)&&(bp->f1 & SELECT)){
   if (lastsel != 0) sel = 1;
   else sel = 0;
  ....
  }
  ....
}

LibreOffice

V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 281, 285. authfld.cxx 281


sal_uInt16  SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
{
  ....
  SwTOXSortTabBase* pOld = aSortArr[i].get();
  if(*pOld == *pNew)
  {
    //only the first occurrence in the document
    //has to be in the array
    if(*pOld < *pNew)
      pNew.reset();
    else // remove the old content
      aSortArr.erase(aSortArr.begin() + i);
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 1827, 1829. doctxm.cxx 1827


Найденные ошибки

Проверено проектов
364
Собрано ошибок
13 504

А ты совершаешь ошибки в коде?

Проверь с помощью
PVS-Studio

Статический анализ
кода для C, C++, C#
и Java

goto PVS-Studio;