Examples of errors detected by the V617 diagnostic.


V617. Consider inspecting the condition. An argument of the '|' bitwise operation always contains a non-zero value.


ffdshow

V617 Consider inspecting the condition. The '0x0002' argument of the '|' bitwise operation contains a non-zero value. tffdshowpageenc.cpp 425


#define ODA_SELECT 0x0002

INT_PTR TffdshowPageEnc::msgProc(UINT uMsg, WPARAM wParam,
                                            LPARAM lParam)
{
  ....
  if ((dis->itemAction | ODA_SELECT)
    && (dis->itemState & ODS_SELECTED)) {
  ....
}

ABackup

V617 Consider inspecting the condition. The '0x00000001' argument of the '|' bitwise operation contains a non-zero value. kitcpp.cpp 304


#define FILE_ATTRIBUTE_READONLY 0x00000001

BOOL DeleteAnyFile( char* cFileName ) {
  ....
  if ( nAttr | FILE_ATTRIBUTE_READONLY ) {
    nAttr &= ~FILE_ATTRIBUTE_READONLY ;
    SetFileAttributes( cFileName, nAttr ) ;
  }
  ....
}

ResizableLib

V617 Consider inspecting the condition. The '0x00000800' argument of the '|' bitwise operation contains a non-zero value. resizablepageex.cpp 88


#define PSP_HIDEHEADER 0x00000800

BOOL CResizablePageEx::NeedsRefresh(....)
{
  if (m_psp.dwFlags | PSP_HIDEHEADER)
    return TRUE;
  ....
}

OpenSSL

V617 Consider inspecting the condition. The '0x0010' argument of the '|' bitwise operation contains a non-zero value. s3_srvr.c 2343


#define EVP_PKT_SIGN 0x0010

int ssl3_get_cert_verify(SSL *s)
{
  int type=0, i, j;
  ....
  if ((peer != NULL) && (type | EVP_PKT_SIGN))
  ....
}

Multi Theft Auto

V617 Consider inspecting the condition. The '0x00000002l' argument of the '|' bitwise operation contains a non-zero value. cproxydirect3ddevice9.cpp 520


#define D3DCLEAR_ZBUFFER 0x00000002l

HRESULT CProxyDirect3DDevice9::Clear(....)
{
  if ( Flags | D3DCLEAR_ZBUFFER )
    CGraphics::GetSingleton().
      GetRenderItemManager ()->SaveReadableDepthBuffer();
  ....
}

Similar errors can be found in some other places:

  • V617 Consider inspecting the condition. The '0x00080000' argument of the '|' bitwise operation contains a non-zero value. cvehiclesa.cpp 1791

Word for Windows 1.1a

V617 Consider inspecting the condition. The '(0x0008 + 0x2000 + 0x4000)' argument of the '|' bitwise operation contains a non-zero value. dlgmisc.c 409


....
#define wkHdr    0x4000
#define wkFtn    0x2000
#define wkAtn    0x0008
....
#define wkSDoc    (wkAtn+wkFtn+wkHdr)

CMD CmdGoto (pcmb)
CMB * pcmb;
{
  ....
  int wk = PwwdWw(wwCur)->wk;
    if (wk | wkSDoc)
      NewCurWw((*hmwdCur)->wwUpper, fTrue);
  ....
}

Most likely this is what should be written here: if (wk & wkSDoc)


WebRTC

V617 Consider inspecting the condition. The 'MAYBE_LOCAL_SSRC' argument of the '|' bitwise operation contains a non-zero value. mediapipelinefilter.cpp 118


static const uint8_t MAYBE_LOCAL_SSRC = 1;

bool MediaPipelineFilter::CheckRtcpSsrc(
  const unsigned char* data,
  size_t len,
  size_t ssrc_offset,
  uint8_t flags) const
{
  ....
  if (flags | MAYBE_LOCAL_SSRC) {
  ....
}

Similar errors can be found in some other places:

  • V617 Consider inspecting the condition. The 'MAYBE_REMOTE_SSRC' argument of the '|' bitwise operation contains a non-zero value. mediapipelinefilter.cpp 124

FreeBSD Kernel

V617 Consider inspecting the condition. The '0x00000080' argument of the '|' bitwise operation contains a non-zero value. mac_bsdextended.c 128


#define  MBO_TYPE_DEFINED 0x00000080

static int
ugidfw_rule_valid(struct mac_bsdextended_rule *rule)
{
  ....
  if ((rule->mbr_object.mbo_neg | MBO_TYPE_DEFINED) &&      // <=
      (rule->mbr_object.mbo_type | MBO_ALL_TYPE) != MBO_ALL_TYPE)
    return (EINVAL);
  if ((rule->mbr_mode | MBI_ALLPERM) != MBI_ALLPERM)
    return (EINVAL);
  return (0);
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;