Examples of errors detected by the V617 diagnostic
V617. Argument of the '|' bitwise operation always contains non-zero value. Consider inspecting the condition.
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);
}
XNU kernel
V617 CWE-480 Consider inspecting the condition. The '0x0001' argument of the '|' bitwise operation contains a non-zero value. nfs_upcall.c 331
#define NFS_UC_QUEUE_SLEEPING 0x0001
static void
nfsrv_uc_proxy(socket_t so, void *arg, int waitflag)
{
....
if (myqueue->ucq_flags | NFS_UC_QUEUE_SLEEPING)
wakeup(myqueue);
....
}
Android
V617 CWE-480 Consider inspecting the condition. The '0x00000001' argument of the '|' bitwise operation contains a non-zero value. egl.cpp 1329
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
EGLContext eglCreateContext(....)
{
....
case EGL_CONTEXT_FLAGS_KHR:
if ((attrib_val | EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) ||
(attrib_val | EGL_CONTEXT_OPENGL_FORWARD_C....) ||
(attrib_val | EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR))
{
context_flags = attrib_val;
} else {
RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_ATTRIBUTE);
}
....
}
Similar errors can be found in some other places:
- V617 CWE-480 Consider inspecting the condition. The '0x00000001' argument of the '|' bitwise operation contains a non-zero value. egl.cpp 1338
Command & Conquer
V617 Consider inspecting the condition. The '((1L << STRUCT_CHRONOSPHERE))' argument of the '|' bitwise operation contains a non-zero value. HOUSE.CPP 5089
typedef enum StructType : char {
STRUCT_NONE=-1,
STRUCT_ADVANCED_TECH,
STRUCT_IRON_CURTAIN,
STRUCT_WEAP,
STRUCT_CHRONOSPHERE, // 3
....
}
#define STRUCTF_CHRONOSPHERE (1L << STRUCT_CHRONOSPHERE)
UrgencyType HouseClass::Check_Build_Power(void) const
{
....
if (State == STATE_THREATENED || State == STATE_ATTACKED) {
if (BScan | (STRUCTF_CHRONOSPHERE)) { // <=
urgency = URGENCY_HIGH;
}
}
....
}
POCO C++ Libraries
V617 Consider inspecting the condition. The '(0x0010)' argument of the '|' bitwise operation contains a non-zero value. PollSet.cpp(398)
// WinSock2.h
#define POLLWRNORM 0x0010
#define POLLOUT (POLLWRNORM)
bool hasSignaledFDs()
{
for (const auto& pollfd : _pollfds)
{
if ((pollfd.revents | POLLOUT) &&
(_wantPOLLOUT.find(pollfd.fd) != _wantPOLLOUT.end()))
{
return true;
}
}
return false;
}
MuditaOS
V617 Consider inspecting the condition. The 'purefs::fs::inotify_flags::close_write' argument of the '|' bitwise operation contains a non-zero value. InotifyHandler.cpp 76
namespace purefs::fs
{
enum class inotify_flags : unsigned
{
attrib = 0x01,
close_write = 0x02,
close_nowrite = 0x04,
del = 0x08,
move_src = 0x10,
move_dst = 0x20,
open = 0x40,
dmodify = 0x80,
};
....
}
sys::MessagePointer InotifyHandler::handleInotifyMessage
(purefs::fs::message::inotify *inotify)
{
....
if (inotify->flags
&& (purefs::fs::inotify_flags::close_write
| purefs::fs::inotify_flags::move_dst))
{
....
}
else if (inotify->flags
&& ( purefs::fs::inotify_flags::del
| purefs::fs::inotify_flags::move_src))
{
....
}
....
}
Similar errors can be found in some other places:
- V617 Consider inspecting the condition. The 'purefs::fs::inotify_flags::del' argument of the '|' bitwise operation contains a non-zero value. InotifyHandler.cpp 79