cea-sec/miasm

View on GitHub

Showing 1,373 of 3,019 total issues

CGen has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class CGen(object):
    """
    Helper to generate C code for a given AsmBlock
    """

Severity: Minor
Found in miasm/jitter/codegen.py - About 3 hrs to fix

    Function simp_compose has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def simp_compose(e_s, expr):
        "Commons simplification on ExprCompose"
        args = merge_sliceto_slice(expr)
        out = []
        # compose of compose
    Severity: Minor
    Found in miasm/expression/simplifications_common.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function create_implicit_flow has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_implicit_flow(lifter, flow_graph, irb_in_nodes, irb_out_nodes):
    
        # first fix IN/OUT
        # If a son read a node which in not in OUT, add it
        todo = set(lifter.blocks.keys())
    Severity: Minor
    Found in miasm/analysis/data_analysis.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File outofssa.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from future.utils import viewitems, viewvalues
    
    from miasm.expression.expression import ExprId
    from miasm.ir.ir import IRBlock, AssignBlock
    from miasm.analysis.ssa import get_phi_sources_parent_block, \
    Severity: Minor
    Found in miasm/analysis/outofssa.py - About 3 hrs to fix

      Function get_mem_access has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_mem_access(mem):
          updt = None
          if isinstance(mem, ExprOp):
              if mem.op == 'preinc':
                  if len(mem.args) == 1:
      Severity: Minor
      Found in miasm/arch/aarch64/sem.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function mn_do_load has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def mn_do_load(ir, instr, arg1, arg2, arg3=None):
          assert instr.name[0] == 'L'
      
          ret = []
      
      
      Severity: Minor
      Found in miasm/arch/ppc/sem.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function set_rva has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_rva(self, rva, size=None):
              self.parent_head.NThdr.optentries[DIRECTORY_ENTRY_IMPORT].rva = rva
              rva_size = self.parent_head._wsize // 8
              if not size:
                  self.parent_head.NThdr.optentries[
      Severity: Minor
      Found in miasm/loader/pe.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function expr_range has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def expr_range(expr):
          """Return a ModularIntervals containing the range of possible values of
          @expr"""
          max_bound = (1 << expr.size) - 1
          if expr.is_int():
      Severity: Minor
      Found in miasm/analysis/expression_range.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function vm2pe has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def vm2pe(myjit, fname, libs=None, e_orig=None,
                min_addr=None, max_addr=None,
                min_section_offset=0x1000, img_base=None,
                added_funcs=None, **kwargs):
          if e_orig:
      Severity: Minor
      Found in miasm/jitter/loader/pe.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function apply_splitting has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_splitting(self, blocks):
              """Consider @blocks' bto destinations and split block in @blocks if one
              of these destinations jumps in the middle of this block.  In order to
              work, they must be only one block in @self per loc_key in
      
      
      Severity: Minor
      Found in miasm/core/asmblock.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function difference has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def difference(self, other):
              """
              Return the difference of intervals
              @other: interval instance
              """
      Severity: Minor
      Found in miasm/core/interval.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function guess_blocks_size has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def guess_blocks_size(self, mnemo):
              """Asm and compute max block size
              Add a 'size' and 'max_size' attribute on each block
              @mnemo: metamn instance"""
              for block in self.blocks:
      Severity: Minor
      Found in miasm/core/asmblock.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function reduce_op_field has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def reduce_op_field(self, node, **kwargs):
              """Reduce field operator (Struct or Union)"""
      
              if not node.expr.is_op('field'):
                  return None
      Severity: Minor
      Found in miasm/core/objc.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function asmblock_final has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def asmblock_final(mnemo, asmcfg, blockChains, conservative=False):
          """Resolve and assemble @blockChains until fixed point is
          reached"""
      
          log_asmblock.debug("asmbloc_final")
      Severity: Minor
      Found in miasm/core/asmblock.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function emul_symb has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def emul_symb(lifter, ircfg, mdis, states_todo, states_done):
          while states_todo:
              addr, symbols, conds = states_todo.pop()
              print('*' * 40, "addr", addr, '*' * 40)
              if (addr, symbols, conds) in states_done:
      Severity: Minor
      Found in example/expression/solve_condition_stp.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function gen_prefix has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def gen_prefix(self):
              v = b""
              rex = 0x40
              if self.g1.value is None:
                  self.g1.value = 0
      Severity: Minor
      Found in miasm/arch/x86/arch.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function update_phi_with_deleted_edges has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def update_phi_with_deleted_edges(ircfg, edges_to_del):
          """
          Update phi which have a source present in @edges_to_del
          @ssa: IRCFG instance in ssa form
          @edges_to_del: edges to delete
      Severity: Minor
      Found in miasm/analysis/data_flow.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function add_block has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_block(self, block):
              """Add a block to JiT and JiT it.
              @block: block to jit
              """
              block_hash = self.hash_block(block)
      Severity: Minor
      Found in miasm/jitter/jitcore_gcc.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function apply_reloc_x86 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def apply_reloc_x86(elf, vm, section, base_addr, loc_db):
          """Apply relocation for x86 ELF contained in the section @section
          @elf: miasm.loader's ELF instance
          @vm: VmMngr instance
          @section: elf's section containing relocation to perform
      Severity: Minor
      Found in miasm/jitter/loader/elf.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function resolve_args_with_symbols has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve_args_with_symbols(self, loc_db):
              args_out = []
              for expr in self.args:
                  # try to resolve symbols using loc_db (0 for default value)
                  loc_keys = m2_expr.get_expr_locs(expr)
      Severity: Minor
      Found in miasm/core/cpu.py - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language