Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
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

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
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 V612…

Examples of errors detected by the V612 diagnostic

V612. Unconditional 'break/continue/return/goto' within a loop.


PCSX2

V612 An unconditional 'break' within a loop. pcsx2 cdvdiso.cpp 218


int DvdRead(u32 lsn, u32 sectors, void *buf,
            CdRMode *mode)
{
  u32 i;
  u8* buff;

  for (i=lsn; i<(lsn+sectors); i++)
  {
    if (CDVDreadTrack(i, CDVD_MODE_2048)==-1)
      return 0;
    buff = CDVDgetBuffer();
    if (buff==NULL) return 0;
//    switch (mode->datapattern){
//      case CdSecS2064:
      ((u32*)buf)[0] = i + 0x30000;
      memcpy_fast((u8*)buf+12, buff, 2048);
      buf = (char*)buf + 2064; break;           // <=
//    default:
//      return 0;
//    }
  }
  return 1;
}

Trans-Proteomic Pipeline

V612 An unconditional 'return' within a loop. tpplib residuemass.cxx 1442


const char* ResidueMass::getStdModResidues(....) {
  ....
  for (rmap::const_iterator i = p.first; i != p.second; ++i) {
    const cResidue &r = (*i).second;
    if (r.m_masses[0].m_nterm) {
      n_term_aa_mod = true;
    } else if (r.m_masses[0].m_cterm) {
      c_term_aa_mod = true;
    }
    return r.m_residue.c_str();            // <=
  }
  ....
}

LLVM/Clang

V612 An unconditional 'break' within a loop. objcarc.cpp 2763


bool
ObjCARCOpt::VisitBottomUp(....) {
  ....
  for (BBState::edge_iterator SI(MyStates.succ_begin()),
       SE(MyStates.succ_end()); SI != SE; ++SI)
  {
    const BasicBlock *Succ = *SI;
    DenseMap<const BasicBlock *, BBState>::iterator I =
      BBStates.find(Succ);
    assert(I != BBStates.end());
    MyStates.InitFromSucc(I->second);
    ++SI;
    for (; SI != SE; ++SI) {
      Succ = *SI;
      I = BBStates.find(Succ);
      assert(I != BBStates.end());
      MyStates.MergeSucc(I->second);
    }
    break;                             // <=
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. objcarc.cpp 2948
  • V612 An unconditional 'break' within a loop. undefinedassignmentchecker.cpp 75
  • V612 An unconditional 'break' within a loop. bugreporter.cpp 1095

D programming language

V612 An unconditional 'return' within a loop. cgxmm.c 825


code *cdvector(elem *e, regm_t *pretregs)
{
  ....
  code *c = CNIL;
  for (int i = 0; i < n; i++)
  {
    c = cat(c, codelem(params[i], pretregs, FALSE));
    *pretregs = 0;      // in case they got set
    return c;
  }
  ....
}

OpenCV

V612 An unconditional 'break' within a loop. blobtrackingmsfg.cpp 600


virtual CvBlob* Process(....)
{
  ....
  while(!m_Collision && m_FGWeight>0)
  {
    ....
    break;
  }
  ....
}

ReactOS

V612 An unconditional 'break' within a loop. pin.c 1839


VOID NTAPI IKsPin_PinCentricWorker(IN PVOID Parameter)
{
  ....
  do
  {
    DPRINT("IKsPin_PinCentricWorker calling "
           "Pin Process Routine\n");
    Status =
      This->Pin.Descriptor->Dispatch->Process(&This->Pin);
    DPRINT("IKsPin_PinCentricWorker Status %lx, "
           "Offset %lu Length %lu\n", Status,
           This->LeadingEdgeStreamPointer.Offset,
           This->LeadingEdgeStreamPointer.Length);
    break;
  } while(This->IrpCount);
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. regexp.c 3633
  • V612 An unconditional 'break' within a loop. hlpfile.c 1131

Windows 8 Driver Samples

V612 An unconditional 'break' within a loop. ap_assocmgr.c 1817


NDIS_STATUS
AmSetApBeaconMode(....)
{
  ....
  while (BeaconEnabled != AssocMgr->BeaconEnabled)
  {
    ndisStatus = ....;
    if (NDIS_STATUS_SUCCESS != ndisStatus)
    {
      break;
    }
    AssocMgr->BeaconEnabled = BeaconEnabled;
    break;
  }
  ....
}

NetXMS

V612 An unconditional 'break' within a loop. tools.cpp 280


static bool MatchStringEngine(....)
{
  ....
  // Handle "*?" case
  while(*MPtr == _T('?'))
  {
    if (*SPtr != 0)
      SPtr++;
    else
      return false;
    MPtr++;
    break;
  }
  ....
}

Chromium

V612 An unconditional 'return' within a loop. picture_layer_impl.cc 638


ResourceProvider::ResourceId
PictureLayerImpl::ContentsResourceId() const
{
  ....
  for (PictureLayerTilingSet::CoverageIterator iter(....);
       iter;
       ++iter)
  {
    if (!*iter)
      return 0;

    const ManagedTileState::TileVersion& tile_version = ....;

    if (....)
      return 0;

    if (iter.geometry_rect() != content_rect)
      return 0;

    return tile_version.get_resource_id();
  }
  return 0;
}

Chromium

V612 An unconditional 'break' within a loop. action_info.cc 76


scoped_ptr<ActionInfo> ActionInfo::Load(....)
{
  ....
  for (base::ListValue::const_iterator iter = icons->begin();
        iter != icons->end(); ++iter)
  {
    std::string path;
    if (....);
      return scoped_ptr<ActionInfo>();
    }

    result->default_icon.Add(....);
    break;
  }
  ....
}

Chromium

V612 An unconditional 'return' within a loop. bluetooth_device_win.cc 224


const BluetoothServiceRecord*
BluetoothDeviceWin::GetServiceRecord(
  const std::string& uuid) const
{
  for (ServiceRecordList::const_iterator iter =
         service_record_list_.begin();
       iter != service_record_list_.end();
       ++iter) {
    return *iter;
  }
  return NULL;
}

Trans-Proteomic Pipeline

V612 An unconditional 'return' within a loop. residuemass.cxx 1442


const char* ResidueMass::getStdModResidues(....) {
  ....
  for (rmap::const_iterator i = p.first; i != p.second; ++i) {
    const cResidue &r = (*i).second;
    if (r.m_masses[0].m_nterm) {
        n_term_aa_mod = true;
    } else if (r.m_masses[0].m_cterm) {
        c_term_aa_mod = true;
    }
    return r.m_residue.c_str();
  }

  if(! strcmp(mod, "+N-formyl-met (Protein)")) {
    return "n";
  } if (! strcmp(mod, "13C6-15N2 (K)")) {
    return "K";
  } if (! strcmp(mod, "13C6-15N4 (R)")) {
    return "R";
  ....
}

Prime95

V612 An unconditional 'break' within a loop. prime95 comm95b.c 133


void registerThreadTermination (void)
{
  ....
  for (i = 0; i < NUM_THREAD_HANDLES; i++) {
    if (THREAD_HANDLES[i] != h) break;
    THREAD_HANDLES[i] = THREAD_HANDLES[--NUM_THREAD_HANDLES];
    break;
  }
}

Geant4 software

V612 An unconditional 'break' within a loop. g4qmdgroundstatenucleus.cc 274


void G4QMDGroundStateNucleus::packNucleons()
{
  ....
  while ( nmTry < maxTrial )
  {
    nmTry++;
    G4int i = 0;
    for ( i = 1 ; i < GetMassNumber() ; i++ )
    {
      ....
    }
    if ( i == GetMassNumber() )
    {
      areTheseMsOK = true;
    }
    break;
  }
  ....
}

gperftools

V612 An unconditional 'return' within a loop. symbolize.cc 154


int SymbolTable::Symbolize() {
  ....
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, child_fds[i]) == -1) {
    for (int j = 0; j < i; j++) {
      close(child_fds[j][0]);
      close(child_fds[j][1]);
      PrintError("Cannot create a socket pair");
      return 0;
    }
  }
  ....
}

Chromium

V612 An unconditional 'return' within a loop. objects.cc 10326


Code* Code::FindFirstCode() {
  ASSERT(is_inline_cache_stub());
  DisallowHeapAllocation no_allocation;
  int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET);
  for (RelocIterator it(this, mask); !it.done(); it.next())
  {
    RelocInfo* info = it.rinfo();
    return
      Code::GetCodeFromTargetAddress(info->target_address());
  }
  return NULL;
}

Firebird

V612 An unconditional 'break' within a loop. lock.cpp 965


SLONG LockManager::queryData(....)
{
  ....
  for (const srq* lock_srq =
         (SRQ) SRQ_ABS_PTR(data_header.srq_backward);
     lock_srq != &data_header;
     lock_srq = (SRQ) SRQ_ABS_PTR(lock_srq->srq_backward))
  {
    const lbl* const lock = ....;
    CHECK(lock->lbl_series == series);
    data = lock->lbl_data;
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. pag.cpp 217

CryEngine 3 SDK

V612 An unconditional 'break' within a loop. weapon.cpp 2854


void CWeapon::AccessoriesChanged(bool initialLoadoutSetup)
{
  ....
  for (int i = 0; i < numZoommodes; i++)
  {
    CIronSight* pZoomMode = ....
    const SZoomModeParams* pCurrentParams = ....
    const SZoomModeParams* pNewParams = ....
    if(pNewParams != pCurrentParams)
    {
      pZoomMode->ResetSharedParams(pNewParams);
    }
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. gunturret.cpp 1647
  • V612 An unconditional 'break' within a loop. vehiclemovementbase.cpp 2362
  • V612 An unconditional 'break' within a loop. vehiclemovementbase.cpp 2382

V8 JavaScript Engine

V612 An unconditional 'return' within a loop. objects.cc 7301


Map* Next() {
  ....
  while (index < number_of_transitions) {
    *TransitionArrayHeader() = Smi::FromInt(index + 1);
    return transition_array_->GetTarget(index);
  }
  ....
}

Data Distribution Service

V612 An unconditional 'return' within a loop. socket.cpp 187


void Socket_Impl::
  send_ (void const* buf, size_t s)
{
  ....
  while (queue_.is_empty ())
  {
    if (timeout)
    {
      if (cond_.wait (&abs_time) != -1)
        break;
    }
    else
    {
      if (cond_.wait () != -1)
        break;
    }

    return -1; // errno is already set
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'return' within a loop. socket.cpp 254

Scilab

V612 An unconditional 'break' within a loop. msgs.c 1293


static int msg_101(int *n, int *ierr)
{
  ....
  for (i=0;i<(int)strlen(line);i++)
  {
    if (line[i]==' ') line[i]='\0';
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. msgs.c 1313
  • V612 An unconditional 'break' within a loop. api_common.cpp 1407

Qt

V612 An unconditional 'break' within a loop. qhelpgenerator.cpp 429


bool QHelpGenerator::registerVirtualFolder(....)
{
  ....
  while (d->query->next()) {
    d->namespaceId = d->query->value(0).toInt();
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. qhelpgenerator.cpp 642

Bitcoin

V612 An unconditional 'return' within a loop. crypter.cpp 169


bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
{
  {
    LOCK(cs_KeyStore);
    if (!SetCrypted())
      return false;

    CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
    for (; mi != mapCryptedKeys.end(); ++mi)
    {
      const CPubKey &vchPubKey = (*mi).second.first;
      const std::vector<unsigned char> &vchCryptedSecret =
        (*mi).second.second;
      CKeyingMaterial vchSecret;
      if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret,
                        vchPubKey.GetHash(), vchSecret))
          return false;
      if (vchSecret.size() != 32)
          return false;
      CKey key;
      key.Set(vchSecret.begin(), vchSecret.end(),
              vchPubKey.IsCompressed());
      if (key.GetPubKey() == vchPubKey)
          break;
      return false;
    }
    vMasterKey = vMasterKeyIn;
  }
  NotifyStatusChanged(this);
  return true;
}

K Desktop Environment

V612 An unconditional 'return' within a loop. bufferfragment_p.h 94


BufferFragment split(char c, unsigned int* start)
{
  while (*start < len) {
    int end = indexOf(c, *start);
    if (end == -1) end = len;
    BufferFragment line(d + (*start), end - (*start));
    *start = end + 1;
    return line;
  }
  return BufferFragment();
}

Miranda NG

V612 An unconditional 'break' within a loop. Popup skin.cpp 807


bool PopupSkin::load(LPCTSTR dir)
{
  ....
  while (hFind != INVALID_HANDLE_VALUE) {
    loadSkin(ffd.cFileName);
    break;
    if (!FindNextFile(hFind, &ffd))
      break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. ICQ icq_servlist.cpp 226
  • V612 An unconditional 'continue' within a loop. Ping rawping.cpp 159
  • V612 An unconditional 'return' within a loop. NotifyAnything main.cpp 304
  • And 1 additional diagnostic messages.

LibreOffice

V612 An unconditional 'break' within a loop. dp_manager.cxx 100


OUString getExtensionFolder(....)
{
  ....
  while (xResultSet->next())
  {
    title = Reference<sdbc::XRow>(
      xResultSet, UNO_QUERY_THROW )->getString(1 /* Title */ ) ;
    break;
  }
  return title;
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. svdfppt.cxx 3260
  • V612 An unconditional 'break' within a loop. svdfppt.cxx 3311
  • V612 An unconditional 'break' within a loop. personalization.cxx 454

Unreal Engine 4

V612 An unconditional 'return' within a loop. codegenerator.cpp 2682


bool FNativeClassHeaderGenerator::WillExportEventParms(....)
{
  for(TFieldIterator<UProperty> It(....); It && (It->....); ++It)
  {
    return true;
  }
  return false;
}

Unreal Engine 4

V612 An unconditional 'return' within a loop. unrealaudiotestgenerators.cpp 49


static float WrapTwoPi(float Value)
{
  while (Value >= TWO_PI)
  {
    return Value -= TWO_PI;
  }

  while (Value < 0)
  {
    return Value += TWO_PI;
  }
  return Value;
}

Similar errors can be found in some other places:

  • V612 An unconditional 'return' within a loop. unrealaudiotestgenerators.cpp 54

FreeSWITCH

V612 An unconditional 'goto' within a loop. mod_verto.c 112


static void json_cleanup(void)
{
  ....
top:

  for (hi = switch_core_hash_first_iter(....); hi;) {
    switch_core_hash_this(hi, &var, NULL, &val);
    json = (cJSON *) val;
    cJSON_Delete(json);
    switch_core_hash_delete(json_GLOBALS.store_hash, var);
    goto top;
  }
  switch_safe_free(hi);

  switch_mutex_unlock(json_GLOBALS.store_mutex);
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. mod_event_socket.c 1643
  • V612 An unconditional 'goto' within a loop. mod_verto.c 328
  • V612 An unconditional 'break' within a loop. mod_verto.c 1993

Unreal Engine 4

V612 An unconditional 'break' within a loop. profilermanager.cpp 717


void FProfilerManager::TrackDefaultStats()
{
  // Find StatId for the game thread.
  for( auto It = GetProfilerInstancesIterator(); It; ++It )
  {
    FProfilerSessionRef ProfilerSession = It.Value();
    if( ProfilerSession->GetMetaData()->IsReady() )
    {
      ....;
    }
    break;
  }
}

Casablanca

V612 An unconditional 'break' within a loop. BlackJack_Client140 messagetypes.h 213


web::json::value AsJSON() const
{
  ....
  int idx = 0;
  for (auto iter = cards.begin(); iter != cards.end();)
  {
    jCards[idx++] = iter->AsJSON();
    break;
  }
  ....
}

Inkscape

V612 An unconditional 'break' within a loop. text_reassemble.c 417


int TR_kern_gap(....)
{
  ....
  while(ptsp && tsp){
    ....
    if(!text32){
      ....
      if(!text32)break;
    }
    ....
    if(!ptxt32){
      ....
      if(!ptxt32)break;
    }
    ....
    break; // <=
  }
  ....
  return(kern);
}

LLVM/Clang

V612 An unconditional 'break' within a loop. MachODump.cpp 1206


static bool checkMachOAndArchFlags(....) {
  ....
  unsigned i;
  for (i = 0; i < ArchFlags.size(); ++i) {
    if (ArchFlags[i] == T.getArchName())
      ArchFound = true;
    break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'return' within a loop. R600OptimizeVectorRegisters.cpp 54
  • V612 An unconditional 'break' within a loop. llvm-size.cpp 525

CMaNGOS

V612 An unconditional 'break' within a loop. Pet.cpp 1956


void Pet::InitPetCreateSpells()
{
  ....
  for (SkillLineAbilityMap::const_iterator
       _spell_idx = bounds.first; _spell_idx != bounds.second;
       ++_spell_idx)
  {
      usedtrainpoints += _spell_idx->second->reqtrainpoints;
      break;
  }
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'break' within a loop. Pet.cpp 895

Audacity

V612 An unconditional 'return' within a loop. Equalization.cpp 379


bool EffectEqualization::ValidateUI()
{
  while (mDisallowCustom && mCurveName.IsSameAs(wxT("unnamed")))
  {
    wxMessageBox(_("...."),
       _("EQ Curve needs a different name"),
       wxOK | wxCENTRE,
       mUIParent);
    return false;
  }
  ....
}

Rosegarden

V612 An unconditional 'break' within a loop. Fingering.cpp 83


Fingering::Barre
Fingering::getBarre() const
{
  int lastStringStatus = m_strings[getNbStrings() - 1];
  Barre res;
  res.fret = lastStringStatus;

  for(unsigned int i = 0; i < 3; ++i) {
    if (m_strings[i] > OPEN && m_strings[i] == lastStringStatus)
      res.start = i;
      break;
  }

  res.end = 5;
  return res;
}

XNU kernel

V612 CWE-670 An unconditional 'goto' within a loop. kern_descrip.c 628


int
dup2(proc_t p, struct dup2_args *uap, int32_t *retval)
{
  ....
  while ((fdp->fd_ofileflags[new] & UF_RESERVED) == UF_RESERVED)
  {
    fp_drop(p, old, fp, 1);
    procfdtbl_waitfd(p, new);
#if DIAGNOSTIC
    proc_fdlock_assert(p, LCK_MTX_ASSERT_OWNED);
#endif
    goto startover;
  }
  ....
startover:
  ....
}

Strange loop body at the end of which there is an unconditional transition to the label startover.

Similar errors can be found in some other places:

  • V612 CWE-670 An unconditional 'goto' within a loop. tty.c 1084
  • V612 CWE-670 An unconditional 'goto' within a loop. vm_purgeable.c 842
  • V612 CWE-670 An unconditional 'return' within a loop. kern_credential.c 930

RT-Thread

V612 CWE-670 An unconditional 'return' within a loop. stm32f7xx_ll_fmc.c 1029


HAL_StatusTypeDef FMC_SDRAM_SendCommand(....)
{
  ....

  /* wait until command is send */
  while(HAL_IS_BIT_SET(Device->SDSR, FMC_SDSR_BUSY))
  {
    /* Check for the Timeout */
    if(Timeout != HAL_MAX_DELAY)
    {
      if((Timeout == 0)||((HAL_GetTick() - tickstart) > Timeout))
      {
        return HAL_TIMEOUT;
      }
    }

    return HAL_ERROR;
  }

  return HAL_OK;
}

LibreOffice

V612 An unconditional 'return' within a loop. pormulti.cxx 891


SwTextAttr const* MergedAttrIterMulti::NextAttr(....)
{
  ....
  SwpHints const*const pHints(m_pNode->GetpSwpHints());
  if (pHints)
  {
    while (m_CurrentHint < pHints->Count())
    {
      SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
      ++m_CurrentHint;
      rpNode = m_pNode;
      return pHint;
    }
  }
  return nullptr;
  ....
}

Similar errors can be found in some other places:

  • V612 An unconditional 'return' within a loop. txtfrm.cxx 144
  • V612 An unconditional 'return' within a loop. txtfrm.cxx 202
  • V612 An unconditional 'return' within a loop. txtfrm.cxx 279

LLVM/Clang

V612 [CWE-670] An unconditional 'return' within a loop. R600OptimizeVectorRegisters.cpp 63


static bool
isImplicitlyDef(MachineRegisterInfo &MRI, unsigned Reg) {
  for (MachineRegisterInfo::def_instr_iterator It = MRI.def_instr_begin(Reg),
      E = MRI.def_instr_end(); It != E; ++It) {
    return (*It).isImplicitDef();
  }
  ....
}

MuseScore

V612 An unconditional 'return' within a loop. noteinputbarmodel.cpp 371


int NoteInputBarModel::resolveCurrentVoiceIndex() const
{
  ....
  for (const Element* element: selection()->elements()) {
      return element->voice();
  }
  ....
}

CARLA

V612 An unconditional 'return' within a loop. EndPoint.h 84


static inline auto make_address(const std::string &address) {
  ....
  boost::asio::ip::tcp::resolver::iterator iter = resolver.resolve(query);
  boost::asio::ip::tcp::resolver::iterator end;
  while (iter != end)
  {
    boost::asio::ip::tcp::endpoint endpoint = *iter++;
    return endpoint.address();
  }
  return boost::asio::ip::make_address(address);
}

GCC

V612 An unconditional 'break' within a loop. ree.cc 985


static bool
combine_reaching_defs (ext_cand *cand,
                       const_rtx set_pat,
                       ext_state *state)
{
  ....
  while (   REG_P (SET_SRC (*dest_sub_rtx))
         && (REGNO (SET_SRC (*dest_sub_rtx)) == REGNO (SET_DEST (set))))
  {
    ....
    if (....)
      break;

    if (....)
      break;

    ....
    break;
  }
}