To get a trial key
fill out the form below
Team License (standard version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Examples of errors detected by the V779…

Examples of errors detected by the V779 diagnostic

April 5, 2021

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

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

Popular related articles
The Evil within the Comparison Functions

Date: 05.19.2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
The way static analyzers fight against false positives, and why they do it

Date: 03.20.2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
PVS-Studio ROI

Date: 01.30.2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
PVS-Studio for Java

Date: 01.17.2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
Appreciate Static Code Analysis!

Date: 10.16.2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: 07.31.2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: 11.21.2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
Free PVS-Studio for those who develops open source projects

Date: 12.22.2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: 10.22.2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
Static analysis as part of the development process in Unreal Engine

Date: 06.27.2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept