Examples of errors detected by the V637 diagnostic
V637. Use of two opposite conditions. 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
MuseScore
V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 4439, 4440. exportxml.cpp 4439
virtual Fraction tick() const override { return _tick; }
void ExportMusicXml::hairpin(....)
{
....
if (hp->tick() != tick) {
writeHairpinText(_xml, hp, hp->tick() == tick);
}
....
}
RPCS3
V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 385, 387. lv2_socket_p2ps.cpp 385
bool lv2_socket_p2ps::handle_listening(p2ps_encapsulated_tcp* tcp_header,
[[maybe_unused]] u8* data,
::sockaddr_storage* op_addr)
{
// ....
if ( tcp_header->flags == p2ps_tcp_flags::SYN
&& backlog.size() < max_backlog)
{
if (backlog.size() >= max_backlog)
{
// ....
}
}
// ....
}
ReactOS
V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 2389, 2392. devinst.c 2389
HDEVINFO WINAPI SetupDiGetClassDevsExW(
CONST GUID *class,
PCWSTR enumstr,
HWND parent,
DWORD flags,
HDEVINFO deviceset,
PCWSTR machine,
PVOID reserved)
{
....
else if (!IsEqualIID(&list->ClassGuid, &GUID_NULL)) // <=
{
/* No class specified. Try to use the one of the deviceset */
if (IsEqualIID(&list->ClassGuid, &GUID_NULL)) // <=
pClassGuid = &list->ClassGuid;
else
{
SetLastError(ERROR_INVALID_PARAMETER);
goto cleanup;
}
}
....
}
DPDK
V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 75, 76. bnx2x_stats.c 75
struct bnx2x_softc {
....
/* tracking a pending STAT_QUERY ramrod */
uint16_t stats_pending;
....
};
static void
bnx2x_storm_stats_post(struct bnx2x_softc *sc)
{
int rc;
if (!sc->stats_pending) {
if (sc->stats_pending)
return;
sc->fw_stats_req->hdr.drv_stats_counter =
htole16(sc->stats_counter++);
....
}