Examples of errors detected by the V779 diagnostic


V779. Unreachable code 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);
}

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();
}

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]);
  }
}


Bugs Found

Checked Projects
363
Collected Errors
13 495