Repository: angr/angr

Issue:
KeyError during CFGFast
I'm getting this exception during the execution of `CFGFast`. I updated via pip this morning. Let me know what other details you need.

It only occurs if I `auto_load_libs`.

```
File ".../analyze.py", line 25, in analyze
    cfg = project.analyses.CFGFast()
  File ".../angr/analyses/analysis.py", line 108, in __call__
    oself.__init__(*args, **kwargs)
  File ".../angr/analyses/cfg/cfg_fast.py", line 1011, in __init__
    self._analyze()
  File ".../angr/analyses/forward_analysis.py", line 552, in _analyze
    self._analysis_core_baremetal()
  File ".../angr/analyses/forward_analysis.py", line 677, in _analysis_core_baremetal
    self._process_job_and_get_successors(job_info)
  File ".../angr/analyses/forward_analysis.py", line 695, in _process_job_and_get_successors
    successors = self._get_successors(job)
  File ".../angr/analyses/cfg/cfg_fast.py", line 1398, in _get_successors
    jobs = self._scan_block(job)
  File ".../angr/analyses/cfg/cfg_fast.py", line 1653, in _scan_block
    entries = self._scan_irsb(cfg_job, current_func_addr)
  File ".../angr/analyses/cfg/cfg_fast.py", line 1776, in _scan_irsb
    if self.functions.get_by_addr(current_func_addr).returning is not True:
  File ".../angr/knowledge_plugins/functions/function_manager.py", line 252, in get_by_addr
    return self._function_map.get(addr)
  File ".../angr/knowledge_plugins/functions/function_manager.py", line 36, in get
    return super(FunctionDict, self).__getitem__(addr)
KeyError: 50409824L
```



Discussion:
Could you provide the output of `angr.misc.bug_report`, and a bit of info about your binary, like architecture, operating system, etc? (or the binary itself) 
```
WARNING | 2018-09-27 11:19:02,584 | angr.analyses.disassembly_utils | Your version of capstone does not support MIPS instruction groups.
angr environment report
=============================
Date: 2018-09-27 11:19:02.724050
Running in virtual environment at .../.virtualenvs/angr
Platform: linux-x86_64
Python version: 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0]
######## angr #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/angr
Pip version angr 7.8.9.26
Couldn't find git info
######## ailment #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/ailment
Pip version ailment 7.8.9.26
Couldn't find git info
######## cle #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/cle
Pip version cle 7.8.9.26
Couldn't find git info
######## pyvex #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/pyvex
Pip version pyvex 7.8.9.26
Couldn't find git info
######## claripy #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/claripy
Pip version claripy 7.8.9.26
Couldn't find git info
######## archinfo #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/archinfo
Pip version archinfo 7.8.9.26
Couldn't find git info
######## ana #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/ana
Pip version ana 0.5
Couldn't find git info
######## simuvex #########
Python could not find simuvex
######## z3 #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/z3
Pip version not found!
Couldn't find git info
######## unicorn #########
Python found it in .../.virtualenvs/angr/local/lib/python2.7/site-packages/unicorn
Pip version unicorn 1.0.1
Couldn't find git info
######### Native Module Info ##########
pyvex: <cffi.api.FFILibrary_.../.virtualenvs/angr/local/lib/python2.7/site-packages/pyvex/lib/libpyvex.so object at 0x7f78176a1890>
z3: <CDLL '.../.virtualenvs/angr/lib/python2.7/site-packages/z3/lib/libz3.so', handle 55997b58a1e0 at 7f7817753e10>
angr: <CDLL '.../.virtualenvs/angr/local/lib/python2.7/site-packages/angr/lib/angr_native.so', handle 55997a9dbed0 at 7f7814b64750>
unicorn: <CDLL '.../.virtualenvs/angr/local/lib/python2.7/site-packages/unicorn/lib/libunicorn.so', handle 55997a307c20 at 7f78169f2310>
```

Binary attached.
[failing-binary.zip](https://github.com/angr/angr/files/2425586/failing-binary.zip)



Resolving patch:
diff --git a/angr/analyses/cfg/cfg_fast.py b/angr/analyses/cfg/cfg_fast.py
--- a/angr/analyses/cfg/cfg_fast.py
+++ b/angr/analyses/cfg/cfg_fast.py
@@ -1755,8 +1755,8 @@ def _scan_irsb(self, cfg_job, current_func_addr):
                              )
         self._function_add_node(cfg_node, function_addr)
 
-        if self.functions.get_by_addr(current_func_addr).returning is not True:
-            self._updated_nonreturning_functions.add(current_func_addr)
+        if self.functions.get_by_addr(function_addr).returning is not True:
+            self._updated_nonreturning_functions.add(function_addr)
 
         # If we have traced it before, don't trace it anymore
         real_addr = self._real_address(self.project.arch, addr)


Test patch: