Примеры ошибок, обнаруженных с помощью диагностики V779
V779. Unreachable code was detected. It is possible that an error is present.
Far2l
V779 Unreachable code detected. It is possible that an error is present. 7z.cpp 203
BOOL WINAPI _export SEVENZ_OpenArchive(const char *Name,
int *Type)
{
Traverser *t = new Traverser(Name);
if (!t->Valid())
{
return FALSE;
delete t; // <=
}
delete s_selected_traverser;
s_selected_traverser = t;
return TRUE;
}
FreeBSD Kernel
V779 Unreachable code detected. It is possible that an error is present. if_wi_pci.c 258
static int
wi_pci_resume(device_t dev)
{
struct wi_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
WI_LOCK(sc);
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
return (0); // <=
WI_UNLOCK(sc); // <=
}
if (ic->ic_nrunning > 0)
wi_init(sc);
WI_UNLOCK(sc);
return (0);
}
Valgrind
V779 Unreachable code detected. It is possible that an error is present. host_arm_isel.c 461
static
Bool doHelperCallWithArgsOnStack ( UInt* stackAdjustAfterCall,
RetLoc* retloc,
ISelEnv* env,
IRExpr* guard,
IRCallee* cee, IRType retTy,
IRExpr** args )
{
....
if (guard) {
if (guard->tag == Iex_Const
&& guard->Iex.Const.con->tag == Ico_U1
&& guard->Iex.Const.con->Ico.U1 == True) {
/* unconditional -- do nothing */
} else {
goto no_match; //ATC // <=
cc = iselCondCode( env, guard ); // <=
}
}
....
}
EFL Core Libraries
V779 Unreachable code detected. It is possible that an error is present. timeout.c 30
extern void _exit (int __status) __attribute__ ((__noreturn__));
static void
_timeout(int val)
{
_exit(-1);
if (val) return;
}
EFL Core Libraries
V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 1102
void
error_and_abort(Eet_File *ef EINA_UNUSED, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
eina_log_vprint(_edje_cc_log_dom, EINA_LOG_LEVEL_CRITICAL,
"unknown", "unknown", 0, fmt, ap);
va_end(ap);
unlink(file_out);
if (watchfile) unlink(watchfile);
exit(-1);
}
static void
data_thread_image_end(....)
{
....
if (iw->errstr)
{
error_and_abort(iw->ef, iw->errstr); // <=
free(iw->errstr); // <=
}
....
}
Similar errors can be found in some other places:
- V779 Unreachable code detected. It is possible that an error is present. evas_gl_core.c 483
- V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 737
- V779 Unreachable code detected. It is possible that an error is present. edje_cc_out.c 835
- And 12 additional diagnostic messages.
Tizen
V779 Unreachable code detected. It is possible that an error is present. bt-hdp.c 295
static int __bt_hdp_internal_add_filter(void)
{
BT_DBG("+");
if (g_hdp_dus_conn) {
BT_ERR("g_hdp_dus_conn already exist");
return BLUETOOTH_ERROR_NONE;
}
g_hdp_dus_conn = _bt_gdbus_get_system_gconn();
retv_if(g_hdp_dus_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
return __bt_hdp_add_filter_subscribe_signal(g_hdp_dus_conn,
TRUE);
BT_DBG("-\n"); // <=
}
Tizen
V779 Unreachable code detected. It is possible that an error is present. Integrity.cpp 233
void Integrity::createHardLink(....) {
int ret = link(oldName.c_str(), newName.c_str());
if (ret < 0) {
int err = errno;
throw UnexpectedErrorException(err, strerror(err));
LOGN("Trying to link to non-existent...", oldName.c_str());
}
}
Tizen
V779 Unreachable code detected. It is possible that an error is present. myplace-suggest.c 68
#define LS_FUNC_ENTER LS_LOGD("(%s) ENTER", __FUNCTION__);
#define LS_FUNC_EXIT LS_LOGD("(%s) EXIT", __FUNCTION__);
static bool __check_myplace_automation(void)
{
LS_FUNC_ENTER
bool myplace_automation_supported = false;
bool myplace_automation_consent = false;
....
return false;
LS_FUNC_EXIT
}
Tizen
V779 Unreachable code detected. It is possible that an error is present. setting-common-view.c 124
#define SETTING_TRACE_END do {\
SECURE_LOGD("\033[0;35mEXIT FUNCTION: %s. \033[0m\n", \
__FUNCTION__);\
} while (0)
EXPORT_PUBLIC
setting_view *setting_view_get_topview(setting_view *view)
{
SETTING_TRACE_BEGIN;
retv_if(NULL == view, NULL);
int idx = 0;
SettingViewNode *viewnode = NULL;
....
if (viewnode && viewnode->topview)
return viewnode->topview;
else
return NULL;
SETTING_TRACE_END; // <=
}
Tizen
V779 Unreachable code detected. It is possible that an error is present. ad-id.c 472
#define AI_FUNC_EXIT AI_LOGD("(%s) EXIT", __FUNCTION__);
int main(int argc, char *argv[])
{
AI_FUNC_ENTER
int ret = APP_ERROR_NONE;
ad_id_app_data_s ad = {0,};
....
if (ret != APP_ERROR_NONE)
AI_LOGE("ui_app_main() is failed. err=%d", ret);
return 0; // <=
AI_FUNC_EXIT // <=
}
Similar errors can be found in some other places:
- V779 Unreachable code detected. It is possible that an error is present. myplace.c 197
- V779 Unreachable code detected. It is possible that an error is present. layout_network.c 1666
MuseScore
V779 Unreachable code detected. It is possible that an error is present. figuredbass.cpp 1377
bool FiguredBass::setProperty(P_ID propertyId, const QVariant& v)
{
score()->addRefresh(canvasBoundingRect());
switch(propertyId) {
default:
return Text::setProperty(propertyId, v);
}
score()->setLayoutAll();
return true;
}
Similar errors can be found in some other places:
- V779 Unreachable code detected. It is possible that an error is present. fingering.cpp 165
- V779 Unreachable code detected. It is possible that an error is present. chordrest.cpp 1127
Audacity
V779 Unreachable code detected. It is possible that an error is present. ToolBar.cpp 706
void ToolBar::MakeRecoloredImage( teBmps eBmpOut, teBmps eBmpIn )
{
// Don't recolour the buttons...
MakeMacRecoloredImage( eBmpOut, eBmpIn );
return;
wxImage * pSrc = &theTheme.Image( eBmpIn );
....
}
Tizen
V779 Unreachable code detected. It is possible that an error is present. main-view.c 261
#define startfunc LOGD("+- START -------------------------");
#define endfunc LOGD("+- END --------------------------");
static Eina_Bool
_main_view_send_result_after_transform(void *data)
{
startfunc
main_view *view = (main_view *)data;
if (view->transformtype == CAM_TRANSFORM_CROP) {
DBG("crop completed, Start resize");
_main_view_ug_send_result(view, view->filename);
_main_view_start_camera_preview(view->camera);
view->transformtype = CAM_TRANSFORM_NONE;
}
return ECORE_CALLBACK_CANCEL; // <=
endfunc // <=
}
ICU
V779 CWE-561 Unreachable code detected. It is possible that an error is present. collationdatabuilder.cpp 392
uint32_t CollationDataBuilder::setPrimaryRangeAndReturnNext(....)
{
....
} else {
// Short range: Set individual CE32s.
for(;;) {
utrie2_set32(....);
++start;
primary = Collation::incThreeBytePrimaryByOffset(....);
if(start > end) { return primary; }
}
modified = TRUE; // <=
}
}
The loop may be interrupted only by calling the operator'return'. This means that assignment, located in the code after the loop will never be executed.
Android
V779 CWE-561 Unreachable code detected. It is possible that an error is present. IAudioFlinger.cpp 733
virtual sp<IEffect> createEffect(....)
{
....
if (pDesc == NULL) {
return effect;
if (status != NULL) {
*status = BAD_VALUE;
}
}
....
}
Similar errors can be found in some other places:
- V779 CWE-561 Unreachable code detected. It is possible that an error is present. bta_hf_client_main.cc 612
- V779 CWE-561 Unreachable code detected. It is possible that an error is present. android_media_ImageReader.cpp 468
- V779 CWE-561 Unreachable code detected. It is possible that an error is present. AMPEG4AudioAssembler.cpp 187
Amazon Lumberyard
V779 CWE-561 Unreachable code detected. It is possible that an error is present. fbxskinimporter.cpp 67
Events::ProcessingResult FbxSkinImporter::ImportSkin(....)
{
....
if (BuildSceneMeshFromFbxMesh(....)
{
context.m_createdData.push_back(std::move(createdData));
return Events::ProcessingResult::Success; // <=
}
else
{
return Events::ProcessingResult::Failure; // <=
}
context.m_createdData.push_back(); // <= fail
return Events::ProcessingResult::Success;
}
Amazon Lumberyard
V779 CWE-561 Unreachable code detected. It is possible that an error is present. dockablelibrarytreeview.cpp 153
bool DockableLibraryTreeView::Init(IDataBaseLibrary* lib)
{
....
if (m_treeView && m_titleBar && m_defaultView)
{
if (m_treeView->topLevelItemCount() > 0)
{
ShowTreeView();
}
else
{
ShowDefaultView();
}
return true; // <=
}
else
{
return false; // <=
}
emit SignalFocused(this); // <= fail
}
Vangers: One For The Road
V779 CWE-561 Unreachable code detected. It is possible that an error is present. univang.cpp 4441
void uvsVanger::break_harvest(void)
{
....
pg = Pworld->escT[0]->Pbunch->
cycleTable[Pworld->escT[0]->Pbunch->currentStage].Pgame;
if (!pg)
{
return;
ErrH.Abort("uvsVanger::break_harvest : don't know where to go ");
}
....
}
Godot Engine
V779 CWE-561 Unreachable code detected. It is possible that an error is present. test_math.cpp 457
MainLoop *test() {
{
float r = 1;
float g = 0.5;
float b = 0.1;
....
print_line("RGBE: " + Color(rd, gd, bd));
return NULL;
}
print_line("Dvectors: " + itos(MemoryPool::allocs_used));
print_line("Mem used: " + itos(MemoryPool::total_memory));
print_line("MAx mem used: " + itos(MemoryPool::max_memory));
PoolVector<int> ints;
ints.resize(20);
....
}
NCBI Genome Workbench
V779 Unreachable code detected. It is possible that an error is present. merge_tree_core.cpp 627
bool CMergeTree::x_FindBefores_Up_Iter(....)
{
....
FirstFrame->Curr = StartCurr;
FirstFrame->Returned = false;
FirstFrame->VisitCount = 0;
FrameStack.push_back(FirstFrame);
while(!FrameStack.empty()) {
....
if(Rel == CEquivRange::eAfter) {
Frame->Returned = false;
FrameStack.pop_back();
continue;
}
else if(Rel == CEquivRange::eBefore) {
....
continue;
}
else {
if(Frame->VisitCount == 0) {
....
continue;
} else {
....
continue;
}
}
Frame->Returned = false; // <=
FrameStack.pop_back();
continue;
} // end stack loop
FirstFrame->ChildFrames.clear();
return FirstFrame->Returned;
}
Similar errors can be found in some other places:
- V779 Unreachable code detected. It is possible that an error is present. dbapi_driver_utils.cpp 351
- V779 Unreachable code detected. It is possible that an error is present. net.c 780
- V779 Unreachable code detected. It is possible that an error is present. bcp.c 1495
- And 2 additional diagnostic messages.
Stellarium
V779 Unreachable code detected. It is possible that an error is present. qcustomplot.cpp 19512
/* inherits documentation from base class */
QCPRange QCPStatisticalBox::
getKeyRange(bool& foundRange, SignDomain inSignDomain) const
{
foundRange = true;
if (inSignDomain == sdBoth)
{
return QCPRange(mKey - mWidth * 0.5, mKey + mWidth * 0.5);
}
else if (inSignDomain == sdNegative)
{
if (mKey + mWidth * 0.5 < 0)
return QCPRange(mKey - mWidth * 0.5, mKey + mWidth * 0.5);
else if (mKey < 0)
return QCPRange(mKey - mWidth * 0.5, mKey);
else
{
foundRange = false;
return QCPRange();
}
}
else if (inSignDomain == sdPositive)
{
if (mKey - mWidth * 0.5 > 0)
return QCPRange(mKey - mWidth * 0.5, mKey + mWidth * 0.5);
else if (mKey > 0)
return QCPRange(mKey, mKey + mWidth * 0.5);
else
{
foundRange = false;
return QCPRange();
}
}
foundRange = false;
return QCPRange();
}
The point is that each if...else branch has a return statement - that's why execution will never reach the last two lines.
rdesktop
V779 Unreachable code detected. It is possible that an error is present. rdesktop.c 1502
int
main(int argc, char *argv[])
{
....
return handle_disconnect_reason(deactivated, ext_disc_reason);
if (g_redirect_username)
xfree(g_redirect_username);
xfree(g_username);
}
LLVM/Clang
V779 [CWE-561] Unreachable code detected. It is possible that an error is present. ExecutionUtils.cpp 146
Error CtorDtorRunner::run() {
....
if (auto CtorDtorMap =
ES.lookup(JITDylibSearchList({{&JD, true}}), std::move(Names),
NoDependenciesToRegister, true))
{
....
return Error::success();
} else
return CtorDtorMap.takeError();
CtorDtorsByPriority.clear();
return Error::success();
}
LLVM/Clang
V779 [CWE-561] Unreachable code detected. It is possible that an error is present. LLParser.cpp 835
bool LLParser::ParseSummaryEntry() {
....
switch (Lex.getKind()) {
case lltok::kw_gv:
return ParseGVEntry(SummaryID);
case lltok::kw_module:
return ParseModuleEntry(SummaryID);
case lltok::kw_typeid:
return ParseTypeIdEntry(SummaryID); // <=
break; // <=
default:
return Error(Lex.getLoc(), "unexpected summary kind");
}
Lex.setIgnoreColonInIdentifiers(false); // <=
return false;
}
Doom 1
V779 [CWE-561] Unreachable code detected. It is possible that an error is present. d_net.c 133
int ExpandTics (int low)
{
int delta;
delta = low - (maketic&0xff);
if (delta >= -64 && delta <= 64)
return (maketic&~0xff) + low;
if (delta > 64)
return (maketic&~0xff) - 256 + low;
if (delta < -64)
return (maketic&~0xff) + 256 + low;
I_Error ("ExpandTics: strange value %i at maketic %i",low,maketic);
return 0;
}
Doom 1
V779 [CWE-561] Unreachable code detected. It is possible that an error is present. wi_stuff.c 591
static int NUMANIMS[....] =
{
sizeof(....)/sizeof(....),
sizeof(....)/sizeof(....),
sizeof(....)/sizeof(....)
};
typedef struct
{
int epsd; // episode # (0-2)
....
} wbstartstruct_t;
static wbstartstruct_t *wbs;
void WI_drawAnimatedBack(void)
{
int i;
anim_t* a;
if (commercial)
return;
if (wbs->epsd > 2)
return;
for (i=0 ; i<NUMANIMS[wbs->epsd] ; i++)
{
a = &anims[wbs->epsd][i];
if (a->ctr >= 0)
V_DrawPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr]);
}
}
GTK
V779 [CWE-561] Unreachable code detected. It is possible that an error is present. gtkcssselector.c 1077
static gboolean
parse_n_plus_b (GtkCssParser *parser,
int before,
int *a,
int *b)
{
const GtkCssToken *token;
token = gtk_css_parser_get_token (parser);
if (gtk_css_token_is_ident (token, "n"))
{
....
return parse_plus_b (parser, FALSE, b);
}
else if (gtk_css_token_is_ident (token, "n-"))
{
....
return parse_plus_b (parser, TRUE, b);
}
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
string_has_number (token->string.string, "n-", b))
{
....
return TRUE;
}
else
{
*b = before;
*a = 0;
return TRUE;
}
gtk_css_parser_error_syntax (parser, "Not a valid an+b type");
return FALSE;
}
Similar errors can be found in some other places:
- V779 [CWE-561] Unreachable code detected. It is possible that an error is present. gtktreemodelfilter.c 3289
LLVM/Clang
V779 [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. AMDILCFGStructurizer.cpp 1286
void llvm::report_fatal_error(const Twine &Reason, bool GenCrashDiag) {
....
abort();
}
void llvm::report_fatal_error(const char *Reason, bool GenCrashDiag) {
report_fatal_error(Twine(Reason), GenCrashDiag);
}
int AMDGPUCFGStructurizer::improveSimpleJumpintoIf(....)
{
....
if (LandBlkHasOtherPred) {
report_fatal_error("Extra register needed to handle CFG");
Register CmpResReg =
HeadMBB->getParent()->getRegInfo().createVirtualRegister(I32RC);
report_fatal_error("Extra compare instruction needed to handle CFG");
insertCondBranchBefore(LandBlk, I, R600::IF_PREDICATE_SET,
CmpResReg, DebugLoc());
}
....
}
DuckStation
V779 Unreachable code detected. It is possible that an error is present. timestamp.cpp 314
bool Timestamp::operator<=(const Timestamp& other) const
{
....
if (m_value.wYear > other.m_value.wYear)
return false;
else if (m_value.wYear < other.m_value.wYear)
return true;
if (m_value.wMonth > other.m_value.wMonth)
return false;
else if (m_value.wMonth < other.m_value.wMonth)
return true;
if (m_value.wDay > other.m_value.wDay)
return false;
else if (m_value.wDay < other.m_value.wDay)
return true;
if (m_value.wHour > other.m_value.wHour)
return false;
else if (m_value.wHour < other.m_value.wHour)
return true;
if (m_value.wMinute > other.m_value.wMinute)
return false;
else if (m_value.wMinute < other.m_value.wMinute)
return true;
if (m_value.wSecond > other.m_value.wSecond)
return false;
else if (m_value.wSecond <= other.m_value.wSecond)
return true;
if (m_value.wMilliseconds > other.m_value.wMilliseconds)
return false;
else if (m_value.wMilliseconds < other.m_value.wMilliseconds)
return true;
return false;
}
FlipperZero
V779 [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. ibutton-cli.cpp 269
void onewire_cli_search(Cli* cli) {
....
bool done = false;
....
while(!done) {
if(onewire.search(address, true) != 1) {
printf("Search finished\r\n");
onewire.reset_search();
done = true;
return;
} else {
printf("Found: ");
for(uint8_t i = 0; i < 8; i++) {
printf("%02X", address[i]);
}
printf("\r\n");
}
delay(100);
}
....
}
FlipperZero
V779 [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. subghz_i.c 44
bool subghz_get_preset_name(SubGhz* subghz, string_t preset) {
const char* preset_name;
switch(subghz->txrx->preset) {
case FuriHalSubGhzPresetOok270Async:
preset_name = "FuriHalSubGhzPresetOok270Async";
break;
case FuriHalSubGhzPresetOok650Async:
....
case FuriHalSubGhzPreset2FSKDev476Async:
preset_name = "FuriHalSubGhzPreset2FSKDev476Async";
break;
FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unknown preset");
default:
....
}
VCMI
V779 Unreachable code detected. It is possible that an error is present. CTrueTypeFont.cpp 86
size_t CTrueTypeFont::getGlyphWidth(const char *data) const
{
if (....)
return fallbackFont->getGlyphWidth(data);
return getStringWidth(....);
int advance;
TTF_GlyphMetrics(....);
return advance;
}
VCMI
V779 Unreachable code detected. It is possible that an error is present. Connection.cpp 115
CConnection::CConnection (....)
{
....
while (endpoint_iterator != end)
{
....
if (!error)
{
init();
return;
}
else
{
throw std::runtime_error(....);
}
endpoint_iterator++;
}
}
VCMI
V779 Unreachable code detected. It is possible that an error is present. CCreatureHandler.cpp 1094
void CCreatureHandler::loadStackExp (....)
{
....
switch (mod[0])
{
....
case 'D':
b.type = BonusType::ADDITIONAL_ATTACK; break;
case 'f':
b.type = BonusType::FEARLESS; break;
case 'F':
b.type = BonusType::FLYING; break;
case 'm':
b.type = BonusType::MORALE; break; // <=
b.val = 1;
b.valType = BonusValueType::INDEPENDENT_MAX;
break;
....
}
}
VCMI
V779 Unreachable code detected. It is possible that an error is present. Animation.cpp 545
bool Animation::loadFrame(size_t frame, size_t group)
{
....
if (....)
{
if (defFile)
{
auto frameList = defFile->getEntries();
if (....)
{
....
return true;
}
}
return false;
// still here? image is missing
printError(frame, group, "LoadFrame");
images[group][frame] = std::make_shared<QImage>("DEFAULT");
}
....
}
Qt Creator
V779 [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. symbolgroupvalue.cpp 1565
static KnownType knownClassTypeHelper(const std::string &type,
std::string::size_type pos,
std::string::size_type endPos)
{
....
// Remaining non-template types
switch (endPos - qPos)
{
....
case 30:
if (!type.compare(qPos, 30, "QPatternist::SequenceType::Ptr"))
return KT_QPatternist_SequenceType_Ptr;
if (!type.compare(qPos, 30, "QXmlStreamNamespaceDeclaration"))
return KT_QXmlStreamNamespaceDeclaration;
break;
case 32:
break; // <=
if (!type.compare(qPos, 32, "QPatternist::Item::Iterator::Ptr"))
return KT_QPatternist_Item_Iterator_Ptr;
case 34:
break; // <=
if (!type.compare(qPos, 34, "QPatternist::ItemSequenceCacheCell"))
return KT_QPatternist_ItemSequenceCacheCell;
case 37:
break; // <=
if (!type.compare(qPos, 37, "QNetworkHeadersPrivate::RawHeaderPair"))
return KT_QNetworkHeadersPrivate_RawHeaderPair;
if (!type.compare(qPos, 37, "QPatternist::AccelTree::BasicNodeData"))
return KT_QPatternist_AccelTree_BasicNodeData;
break;
}
return KT_Unknown;
}
qdEngine
V779 [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. qd_game_scene.cpp 1245
bool qdGameScene::follow_path_seek(qdGameObjectMoving* pObj, bool lock_target)
{
if (qdGameObjectMoving::FOLLOW_UPDATE_PATH == pObj->follow_condition())
selected_object_->set_grid_zone_attributes(sGridCell::CELL_SELECTED);
return pObj->move(selected_object_->last_move_order(), lock_target);
if (qdGameObjectMoving::FOLLOW_UPDATE_PATH == pObj->follow_condition())
selected_object_->drop_grid_zone_attributes(sGridCell::CELL_SELECTED);
}
Telegram
V779 Unreachable code detected. It is possible that an error is present. local_storage_box.cpp 245
void LocalStorageBox::Row::paintEvent(QPaintEvent *e)
{
if (!_progress || true) // <=
{
return;
}
auto p = QPainter(this);
const auto padding = st::localStorageRowPadding;
const auto height = st::localStorageRowHeight;
const auto bottom = height - padding.bottom() - _description->height();
_progress->draw(p,
{
st::proxyCheckingPosition.x() + padding.left(),
st::proxyCheckingPosition.y() + bottom
},
width());
}