Repository: angr/angr

Issue:
An error occurred while analysis the CFG of the mips program.
An error occurs when I use angr to analyze the CFG of the mips program (net-cgi). 
The error message is shown below.

>  File "/home/user/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py", line 106, in _resolve
    gp_used = self._is_gp_used_on_slice(project, b)
  File "/home/user/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py", line 183, in _is_gp_used_on_slice
    stmt = block.vex.statements[block_stmt_idx]
IndexError: list index out of range

The code is shown below.
```
import angr
proj = angr.Project(net-cgi, auto_load_libs=False)
cfg = proj.analyses.CFG()
```

The net-cgi can be found in [net-cgi.zip](https://github.com/angr/angr/files/8160732/net-cgi.zip)





Discussion:
I noticed that the block address where the error occurred is a struct
![403064](https://user-images.githubusercontent.com/43575651/156150729-4a52f3fe-c01d-4339-8875-2dd1de558aa6.png)



Resolving patch:
diff --git a/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py b/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py
--- a/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py
+++ b/angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py
@@ -9,7 +9,7 @@
 from ....blade import Blade
 from ....annocfg import AnnotatedCFG
 from ....exploration_techniques import Slicecutor
-
+from ....utils.constants import DEFAULT_STATEMENT
 from .resolver import IndirectJumpResolver
 
 if TYPE_CHECKING:
@@ -61,7 +61,7 @@ def resolve(self, cfg, addr, func_addr, block, jumpkind):
                 return resolved, resolved_targets
         return False, []
 
-    def _resolve(self, cfg, addr, func_addr, block, jumpkind, max_level):
+    def _resolve(self, cfg, addr, func_addr, block, jumpkind, max_level):  # pylint:disable=unused-argument
         """
         Resolves the indirect jump in MIPS ELF binaries where all external function calls are indexed using gp.
 
@@ -179,12 +179,17 @@ def _is_gp_used_on_slice(project, b: Blade) -> bool:
             if block_addr not in blocks_on_slice:
                 blocks_on_slice[block_addr] = project.factory.block(block_addr, cross_insn_opt=False)
             block = blocks_on_slice[block_addr]
-            stmt = block.vex.statements[block_stmt_idx]
-            if isinstance(stmt, pyvex.IRStmt.WrTmp) \
-                    and isinstance(stmt.data, pyvex.IRExpr.Get) \
-                    and stmt.data.offset == gp_offset:
-                gp_used = True
-                break
+            if block_stmt_idx == DEFAULT_STATEMENT:
+                if isinstance(block.vex.next, pyvex.IRExpr.Get) and block.vex.next.offset == gp_offset:
+                    gp_used = True
+                    break
+            else:
+                stmt = block.vex.statements[block_stmt_idx]
+                if isinstance(stmt, pyvex.IRStmt.WrTmp) \
+                        and isinstance(stmt.data, pyvex.IRExpr.Get) \
+                        and stmt.data.offset == gp_offset:
+                    gp_used = True
+                    break
         else:
             gp_used = False
 


Test patch: