Примеры ошибок, обнаруженных с помощью диагностики V646
V646. The 'else' keyword may be missing. Consider inspecting the program's logic.
VirtualDub
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. VirtualDub optdlg.cpp 120
void VDDialogAudioConversionW32::RecomputeBandwidth() {
....
if (IsDlgButtonChecked(mhdlg, IDC_PRECISION_NOCHANGE)) {
if (mbSourcePrecisionKnown && mbSource16Bit)
bps *= 2;
else
bps = 0;
} if (IsDlgButtonChecked(mhdlg, IDC_PRECISION_16BIT))
bps *= 2;
....
}
Geant4 software
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. _G4processes-archive g4embiasingmanager.cc 299
G4double
G4EmBiasingManager::ApplySecondaryBiasing(....)
{
....
if(0 == nsplit) {
if(safety > fSafetyMin) {
ApplyRangeCut(vd, track, eloss, safety);
}
} if(1 == nsplit) {
weight = ApplyRussianRoulette(vd, index);
} else {
G4double tmpEnergy = ....;
G4ThreeVector tmpMomDir = ....;
weight = ....;
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
}
....
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. _G4processes-archive g4embiasingmanager.cc 347
K Desktop Environment
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. karchive.cpp 187
*bool KArchive::close()
{
....
// if d->saveFile is not null then it is equal to d->dev.
if ( d->saveFile ) {
closeSucceeded = d->saveFile->finalize();
delete d->saveFile;
d->saveFile = 0;
} if ( d->deviceOwned ) { // <=
delete d->dev; // we created it ourselves in open()
}
....
}
Spring Engine
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. streflop s_atanf.cpp 90
Simple __atanf(Simple x)
{
....
ix = hx&0x7fffffff;
if(ix>=0x50800000) { /* if |x| >= 2^34 */
if(ix>0x7f800000)
return x+x; /* NaN */
if(hx>0) return atanhi[3]+atanlo[3];
else return -atanhi[3]-atanlo[3];
} if (ix < 0x3ee00000) { /* |x| < 0.4375f */ // <=
if (ix < 0x31000000) { /* |x| < 2^-29 */
if(huge+x>one) return x; /* raise inexact */
}
id = -1;
} else {
....
}
....
}
Simple DirectMedia Layer
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. SDL2 s_atan.c 82
double atan(double x)
{
double w,s1,s2,z;
int32_t ix,hx,id;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x44100000) { /* if |x| >= 2^66 */
....
} if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ // <=
if (ix < 0x3e200000) { /* |x| < 2^-29 */
if(huge+x>one) return x; /* raise inexact */
}
id = -1;
} else {
....
}
....
}
Haiku Operation System
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. Filter.cpp 760
uchar
Scaler::Limit(intType value)
{
if (value < 0) {
value = 0;
} if (value > 255) {
value = 255;
}
return value;
}
Telegram
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. Telegram history.cpp 5181
void HistoryImageLink::getState(....
const HistoryItem *parent, ....)
const
{
....
int skipx = 0, skipy = 0, height = _height;
const HistoryReply *reply = toHistoryReply(parent);
const HistoryForwarded *fwd = reply ? 0 :
toHistoryForwarded(parent);
....
if (reply) {
skipy = st::msgReplyPadding.top() +
st::msgReplyBarSize.height() +
st::msgReplyPadding.bottom();
} if (fwd) {
skipy = st::msgServiceNameFont->height +
st::msgPadding.top();
}
....
}
FreeSWITCH
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. conference_api.c 1532
switch_status_t conference_api_sub_vid_logo_img(....)
{
....
if (!strcasecmp(text, "allclear")) {
switch_channel_set_variable(member->channel, "....", NULL);
member->video_logo = NULL;
} if (!strcasecmp(text, "clear")) { // <=
member->video_logo = NULL;
} else {
member->video_logo = switch_core_strdup(member->pool, text);
}
....
}
Mozilla Thunderbird
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. nsnativethemewin.cpp 924
nsresult
nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
uint8_t aWidgetType,
int32_t& aPart,
int32_t& aState)
{
....
{
....
if (!aFrame) {
aState = TS_NORMAL;
} else {
if (GetCheckedOrSelected(aFrame, !isCheckbox)) {
inputState = CHECKED;
} if (isCheckbox && GetIndeterminate(aFrame)) {
inputState = INDETERMINATE;
}
....
} ....
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. debugger.cpp 4794
FreeBSD Kernel
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. mac_process.c 352
static void
mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred,
struct vm_map *map)
{
....
if (!mac_mmap_revocation_via_cow) {
vme->max_protection &= ~VM_PROT_WRITE;
vme->protection &= ~VM_PROT_WRITE;
} if ((revokeperms & VM_PROT_READ) == 0) // <=
vme->eflags |= MAP_ENTRY_COW |
MAP_ENTRY_NEEDS_COPY;
....
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7006
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7032
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7058
- And 2 additional diagnostic messages.
Serious Engine 1 v.1.10
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. sessionstate.cpp 1191
void CSessionState::ProcessGameStream(void)
{
....
if (res==CNetworkStream::R_OK) {
....
} if (res==CNetworkStream::R_BLOCKNOTRECEIVEDYET) { // <=
....
} else if (res==CNetworkStream::R_BLOCKMISSING) {
....
}
....
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. terrain.cpp 759
Inkscape
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. sp-item.cpp 204
void SPItem::resetEvaluated()
{
if ( StatusCalculated == _evaluated_status ) {
....
} if ( StatusSet == _evaluated_status ) { // <=
....
}
}
Aspell
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. language.cpp 386
void Language::fix_case(CasePattern case_pattern,
char * res, const char * str) const
{
if (!str[0]) return;
if (case_pattern == AllUpper) {
to_upper(res,str);
} if (case_pattern == FirstUpper && is_lower(str[0])) { // <=
*res = to_title(str[0]);
if (res == str) return;
res++;
str++;
while (*str) *res++ = *str++;
*res = '\0';
} else {
if (res == str) return;
while (*str) *res++ = *str++;
*res = '\0';
}
}
EFL Core Libraries
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. dns.c 1430
char *dns_d_init(void *dst, size_t lim, const void *src,
size_t len, int flags)
{
if (flags & DNS_D_TRIM) {
dns_d_trim(dst, lim, src, len, flags);
} if (flags & DNS_D_ANCHOR) { // <=
dns_d_anchor(dst, lim, src, len);
} else {
memmove(dst, src, MIN(lim, len));
if (lim > 0)
((char *)dst)[MIN(len, lim - 1)] = '\0';
}
return dst;
}
Tizen
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. client-offline.cpp 52
ClientOffline::ClientOffline(bool wakeUp)
: m_offlineMode(false)
, m_serviceLock(nullptr)
{
....
if (wakeUp && m_serviceLock->Locked()) {
....
if (ClientRequest(.....).send().failed()) {
LogInfo("Socket activation attempt failed.");
m_serviceLock->Lock();
m_offlineMode = m_serviceLock->Locked();
} else
LogInfo("Service seems to be running now.");
} if (m_serviceLock->Locked()) { // <=
m_offlineMode = true;
}
....
}
XNU kernel
V646 CWE-670 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. in.c 2010
static void
in_ifaddr_free(struct ifaddr *ifa)
{
IFA_LOCK_ASSERT_HELD(ifa);
if (ifa->ifa_refcnt != 0) {
panic("%s: ifa %p bad ref cnt", __func__, ifa);
/* NOTREACHED */
} if (!(ifa->ifa_debug & IFD_ALLOC)) {
panic("%s: ifa %p cannot be freed", __func__, ifa);
/* NOTREACHED */
}
if (ifa->ifa_debug & IFD_DEBUG) {
....
}
Not sure if this is a bug. Perhaps, one forgot to write 'else'. Similar warnings:
Similar errors can be found in some other places:
- V646 CWE-670 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. kern_malloc.c 836
- V646 CWE-670 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. ipc_kmsg.c 4229
Krita
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. SvgStyleWriter.cpp 82
void SvgStyleWriter::saveSvgBasicStyle(KoShape *shape,
SvgSavingContext &context)
{
if (!shape->isVisible(false)) {
....
} if (shape->transparency() > 0.0) { // <=
....
}
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. transform_stroke_strategy.cpp 166
LLVM/Clang
V646 [CWE-670] Consider inspecting the application's logic. It's possible that 'else' keyword is missing. AMDGPUAsmParser.cpp 5655
void AMDGPUAsmParser::cvtDPP(MCInst &Inst, const OperandVector &Operands) {
....
if (Op.isReg() && Op.Reg.RegNo == AMDGPU::VCC) {
// VOP2b (v_add_u32, v_sub_u32 ...) dpp use "vcc" token.
// Skip it.
continue;
} if (isRegOrImmWithInputMods(Desc, Inst.getNumOperands())) { // <=
Op.addRegWithFPInputModsOperands(Inst, 2);
} else if (Op.isDPPCtrl()) {
Op.addImmOperands(Inst, 1);
} else if (Op.isImm()) {
// Handle optional arguments
OptionalIdx[Op.getImmTy()] = I;
} else {
llvm_unreachable("Invalid operand type");
}
....
}
ROOT
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. TProofServ.cxx 729
TProofServ::TProofServ(Int_t *argc, char **argv, FILE *flog)
: TApplication("proofserv", argc, argv, 0, -1)
{
....
if (!logmx.IsDigit()) {
if (logmx.EndsWith("K")) {
xf = 1024;
logmx.Remove(TString::kTrailing, 'K');
} else if (logmx.EndsWith("M")) {
xf = 1024*1024;
logmx.Remove(TString::kTrailing, 'M');
} if (logmx.EndsWith("G")) {
xf = 1024*1024*1024;
logmx.Remove(TString::kTrailing, 'G');
}
}
....
}
Similar errors can be found in some other places:
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. TFormula_v5.cxx 3702
- V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. RooAbsCategory.cxx 604
Minetest
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. treegen.cpp 413
treegen::error make_ltree(...., TreeDef tree_definition)
{
....
std::stack <core::matrix4> stack_orientation;
....
if ((stack_orientation.empty() &&
tree_definition.trunk_type == "double") ||
(!stack_orientation.empty() &&
tree_definition.trunk_type == "double" &&
!tree_definition.thin_branches)) {
....
} else if ((stack_orientation.empty() &&
tree_definition.trunk_type == "crossed") ||
(!stack_orientation.empty() &&
tree_definition.trunk_type == "crossed" &&
!tree_definition.thin_branches)) {
....
} if (!stack_orientation.empty()) { // <=
....
}
....
}
Qemu
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. pl181.c 400
static void pl181_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
....
if (s->cmd & PL181_CMD_ENABLE) {
if (s->cmd & PL181_CMD_INTERRUPT) {
....
} if (s->cmd & PL181_CMD_PENDING) { // <= else if
....
} else {
....
}
....
}
....
}
ReactOS
V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. id_ata.cpp 7820
ULONG
NTAPI
AtapiSendCommand(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb,
IN ULONG CmdAction)
{
....
if((Srb->Cdb[0] == SCSIOP_REQUEST_SENSE)
&& !(deviceExtension->HwFlags & UNIATA_SATA)) {
KdPrint2((
PRINT_PREFIX "AtapiSendCommand: SCSIOP_REQUEST_SENSE -> no dma setup (2)\n"
));
....
AtapiDmaReinit(deviceExtension, LunExt, AtaReq);
} if(AtaReq->TransferLength) { // <=
if(!dma_reinited) {
KdPrint2((PRINT_PREFIX "AtapiSendCommand: AtapiDmaReinit()\n"));
AtapiDmaReinit(deviceExtension, LunExt, AtaReq);
....
}
} else {
KdPrint2((PRINT_PREFIX "AtapiSendCommand: zero transfer\n"));
....
if(!deviceExtension->opt_AtapiDmaZeroTransfer
&& !(deviceExtension->HwFlags & UNIATA_SATA)) {
KdPrint2((PRINT_PREFIX "AtapiSendCommand: AtapiDmaReinit() to PIO\n"));
AtapiDmaReinit(deviceExtension, LunExt, AtaReq);
}
}
....
}