Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the...

Examples of errors detected by the V640 diagnostic

V640. Code's operational logic does not correspond with its formatting.


Android

V640 CWE-483 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. k_rem_pio2.c 314


int
__kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec)
{
  ....
  for (i=0;i<=jk;i++) {
    for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
  }
  ....
}

Tizen

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. bluetooth-tds.c 313


int bt_tds_provider_send_activation_resp(char *address,
  int result, bt_tds_provider_h provider)
{
  ....
  if (error_code != BT_ERROR_NONE)
    BT_ERR("%s(0x%08x)", ......);
    return error_code;

  return error_code;
}

Tizen

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. media_codec_port_gst.c 1800


#define MC_FREEIF(x) \
  if (x) \
    g_free(x); \
  x = NULL;

static gboolean __mc_gst_init_gstreamer()
{
  ....
  int i = 0;
  ....
  for (i = 0; i < arg_count; i++)
    MC_FREEIF(argv2[i]);
  ....
}

Augeas

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. augtool.c 551


static int run_args(int argc, char **argv) {
  ....
  if (code >= 0 && auto_save)
      if (echo_commands)                            // <=
          printf("%ssave\n", AUGTOOL_PROMPT);       // <=
      code = run_command("save");                   // <=

  if (code < 0) {
      code = -1;
      print_aug_error();
  }
  ....
}

FreeBSD Kernel

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. smbfs_vnops.c 283


static int
smbfs_getattr(ap)
struct vop_getattr_args *ap;
{
  ....
  if (np->n_flag & NOPEN)
    np->n_size = oldsize;
    smbfs_free_scred(scred);
  return 0;
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. ctl.c 8569
  • V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. ieee80211_ioctl.c 2019
  • V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. in_mcast.c 1063
  • And 1 additional diagnostic messages.

GCC

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. asan.c 2582


void initialize_sanitizer_builtins (void)
{
  ....
  #define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
  decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
             BUILT_IN_NORMAL, NAME, NULL_TREE);  \
  set_call_expr_flags (decl, ATTRS);          \
  set_builtin_decl (ENUM, decl, true);

  #include "sanitizer.def"

  if ((flag_sanitize & SANITIZE_OBJECT_SIZE)
      && !builtin_decl_implicit_p (BUILT_IN_OBJECT_SIZE))
    DEF_SANITIZER_BUILTIN (BUILT_IN_OBJECT_SIZE, "object_size",
         BT_FN_SIZE_CONST_PTR_INT,
         ATTR_PURE_NOTHROW_LEAF_LIST)
  ....
}

CMaNGOS

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. instance_blackrock_depths.cpp 111


void
instance_blackrock_depths::OnCreatureCreate(Creature* pCreature)
{
  switch (pCreature->GetEntry())
  {
    ....
    case NPC_HAMMERED_PATRON:
      ....
      if (m_auiEncounter[11] == DONE)
        pCreature->SetFactionTemporary(....);
        pCreature->SetStandState(UNIT_STAND_STATE_STAND); // <=
      break;
    case NPC_PRIVATE_ROCKNOT:
    case NPC_MISTRESS_NAGMARA:
    ....
  }
}

CryEngine V

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. livingentity.cpp 181


CLivingEntity::~CLivingEntity()
{
  for(int i=0;i<m_nParts;i++) {
    if (!m_parts[i].pPhysGeom || ....)
      delete[] m_parts[i].pMatMapping; m_parts[i].pMatMapping=0;
  }
  ....
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. physicalworld.cpp 2449
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. articulatedentity.cpp 1723
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. articulatedentity.cpp 1726

Haiku Operation System

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. strftime.c 1263


#define DO_NUMBER(d, v) \
    digits = width == -1 ? d : width; \
    number_value = v; goto do_number

size_t
my_strftime (s, maxsize, format, tp extra_args)
{
  ....
  if (modifier == L_('O'))
    goto bad_format;
  else
    DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
  ....
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. strftime.c 1267

Spring Engine

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. AAI aaibrain.cpp 1138


void AAIBrain::BuildUnitOfMovementType(....)
{
  ....
  if(ai->Getbt()->units_static[unit].cost < ....)
  {
    if(ai->Getexecute()->AddUnitToBuildqueue(unit, 3, urgent))
    {
      ai->Getbt()->units_dynamic[unit].requested += 3;
      ai->Getut()->UnitRequested(....);
    }
  }
  else if(ai->Getbt()->units_static[unit].cost < ....)
  {
    if(ai->Getexecute()->AddUnitToBuildqueue(unit, 2, urgent))
      ai->Getbt()->units_dynamic[unit].requested += 2;
      ai->Getut()->UnitRequested(....);
  }
  else
  {
    if(ai->Getexecute()->AddUnitToBuildqueue(unit, 1, urgent))
      ai->Getbt()->units_dynamic[unit].requested += 1;
      ai->Getut()->UnitRequested(....);
  }
  ....
}

Spring Engine

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. sound oggstream.cpp 256


bool COggStream::UpdateBuffers()
{
  ....
  active = DecodeStream(buffer);
  if (active)
    alSourceQueueBuffers(source, 1, &buffer); CheckError("....");
  ....
}

Miranda NG

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. TabSRMM infopanel.cpp 370


void CInfoPanel::renderContent(const HDC hdc)
{
  ....
  if (m_height >= DEGRADE_THRESHOLD)
    rc.top -= 2; rc.bottom -= 2;
  ....
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. MSN msn_p2p.cpp 385
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. SecureIM crypt_lists.cpp 13
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. SecureIM crypt_lists.cpp 44
  • And 2 additional diagnostic messages.

Oracle VM Virtual Box

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. vboxguestr3libdraganddrop.cpp 656


static int vbglR3DnDGHProcessRequestPendingMessage(....)
{
  ....
  rc = Msg.hdr.result;
  if (RT_SUCCESS(rc))
    rc = Msg.uScreenId.GetUInt32(puScreenId); AssertRC(rc); // <=
  ....
}

Oracle VM Virtual Box

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. snapshotimpl.cpp 1649


STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)
{
  ....
  if (fOnline)
    //no need to test for whether the saved state file is shared:
    //an online snapshot means that a new saved state file was
    //created, which we must clean up now
    RTFileDelete(mConsoleTaskData.mSnapshot->....);
    machineLock.acquire();                  // <=

  mConsoleTaskData.mSnapshot->uninit();
  machineLock.release();
  ....
}

FFmpeg

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. vc1dec.c 1917


static void vc1_interp_mc(VC1Context *v)
{
  ....
  if (v->field_mode) {
      if (v->cur_field_type != v->ref_field_type[1])
          my   = my   - 2 + 4 * v->cur_field_type;
          uvmy = uvmy - 2 + 4 * v->cur_field_type;
  }
  ....
}

Geant4 software

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. g4rtjpegcoder.cc 270


void
G4JpegCoder::ForwardDCT(int* picData)
{
  for( int v=0; v<8; v++ ){
    double cv = v ? 1.0 : DisSqrt2;
    for( int u=0; u<8; u++ ){
      double cu = u ? 1.0 : DisSqrt2;
      double sum = 0;

      for( int y=0; y<8; y++ )
        for( int x=0; x<8; x++ )
          sum += picData[ y * 8 + x ] *
                 mCosT[u][x] * mCosT[v][y];
          mDCTData[ v * 8 + u ] = int( sum * cu * cv / 4 );
        }
    }
}

EA WebKit

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. frameview.cpp 1216


void FrameView::adjustMediaTypeForPrinting(bool printing)
{
  ....
  if (printing) {
    if (m_mediaTypeWhenNotPrinting.isNull())
      m_mediaTypeWhenNotPrinting = mediaType();
      setMediaType("print");
  } else {
  ....
}

Chromium

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. nss_memio.c 152


static int memio_buffer_put(....)
{
  ....
  if (len > 0) {
    memcpy(&mb->buf[mb->tail], buf, len);
    mb->tail += len;
    if (mb->tail == mb->bufsize)
       mb->tail = 0;
       transferred += len;
  }
  ....
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. nss_memio.c 184

Chromium

V640 The code's operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. trace_event_unittest.cc 57


void OnTraceNotification(int notification) {
  if (notification & TraceLog::EVENT_WATCH_NOTIFICATION)
    ++event_watch_notification_;
    notifications_received_ |= notification;
}

Windows 8 Driver Samples

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. st_scan.c 564


#define MP_FREE_MEMORY(_Memory) \
  MpFreeMemory(_Memory); _Memory = NULL;

NDIS_STATUS
StaStartScan(....)
{
  ....
  if (pExternalScanRequest != NULL)
    MP_FREE_MEMORY(pExternalScanRequest);
  ....
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. base_port_send.c 642
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. hw_context.c 1579
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. hw_mac.c 1169
  • And 4 additional diagnostic messages.

ReactOS

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. stat.c 24


#define stat64_to_stat(buf64, buf)   \
    buf->st_dev   = (buf64)->st_dev;   \
    buf->st_ino   = (buf64)->st_ino;   \
    buf->st_mode  = (buf64)->st_mode;  \
    buf->st_nlink = (buf64)->st_nlink; \
    buf->st_uid   = (buf64)->st_uid;   \
    buf->st_gid   = (buf64)->st_gid;   \
    buf->st_rdev  = (buf64)->st_rdev;  \
    buf->st_size  = (_off_t)(buf64)->st_size;  \
    buf->st_atime = (time_t)(buf64)->st_atime; \
    buf->st_mtime = (time_t)(buf64)->st_mtime; \
    buf->st_ctime = (time_t)(buf64)->st_ctime; \

int CDECL _tstat(const _TCHAR* path, struct _stat * buf)
{
  int ret;
  struct __stat64 buf64;

  ret = _tstat64(path, &buf64);
  if (!ret)
    stat64_to_stat(&buf64, buf);
  return ret;
}

Similar errors can be found in some other places:

  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. stat.c 35
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. stat.c 47
  • V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. stat.c 58

Xpdf

V640 Consider inspecting the application's logic. It is possible that several statements should be braced. active.c 423


static void actlist_splay(actlist_t*a, point_t p1, point_t p2)
{

  ....
  while(1)
  {
    ....
    if(!a->root->rightchild)
      c = 1;break;
    ....
  }
}

XUIFramework

V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. cxstatic.cpp 381


BOOL CxStatic::SetBitmap(....)
{
  ....

  if (! m_pImage->CreateFromHBITMAP(hBitmap) )
    delete m_pImage; m_pImage = NULL;
    return FALSE;

  ....
}