cea-sec/miasm

View on GitHub

Showing 1,647 of 3,020 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def get_arg_n_stdcall(self, index):
        if index < 4:
            arg = getattr(self.cpu, 'R%d' % index)
        else:
            arg = self.get_stack_arg(index-4)
Severity: Major
Found in miasm/arch/arm/jit.py and 1 other location - About 2 hrs to fix
miasm/arch/mips32/jit.py on lines 131..136

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def get_arg_n_stdcall(self, index):
        if index < 4:
            arg = getattr(self.cpu, 'A%d' % index)
        else:
            arg = self.get_stack_arg(index-4)
Severity: Major
Found in miasm/arch/mips32/jit.py and 1 other location - About 2 hrs to fix
miasm/arch/arm/jit.py on lines 106..111

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_gt(arg1):
    cond = cond2expr['GT']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_cc(arg1):
    cond = cond2expr['CC']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_eq(arg1):
    cond = cond2expr['EQ']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_ge(arg1):
    cond = cond2expr['GE']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_ls(arg1):
    cond = cond2expr['LS']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

def sqrtsd(_, instr, dst, src):
    e = []
    e.append(m2_expr.ExprAssign(dst[:64],
                             m2_expr.ExprOp('fsqrt',
                                            src[:64])))
Severity: Major
Found in miasm/arch/x86/sem.py and 6 other locations - About 2 hrs to fix
miasm/arch/x86/sem.py on lines 4239..4243
miasm/arch/x86/sem.py on lines 4246..4250
miasm/arch/x86/sem.py on lines 4267..4271
miasm/arch/x86/sem.py on lines 4274..4278
miasm/arch/x86/sem.py on lines 4281..4285
miasm/arch/x86/sem.py on lines 4760..4765

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_pl(arg1):
    cond = cond2expr['PL']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1725..1730
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

aarch64op("fmov",  [bs('0'), bs('00'), bs('11110'), bs('00'), bs('1'), bs('00'), bs('110'), bs('000000'), sn32, rd32], [rd32, sn32])
Severity: Major
Found in miasm/arch/aarch64/arch.py and 5 other locations - About 2 hrs to fix
miasm/arch/aarch64/arch.py on lines 2187..2187
miasm/arch/aarch64/arch.py on lines 2188..2188
miasm/arch/aarch64/arch.py on lines 2189..2189
miasm/arch/aarch64/arch.py on lines 2190..2190
miasm/arch/aarch64/arch.py on lines 2317..2317

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

aarch64op("fmov",  [bs('1'), bs('00'), bs('11110'), bs('01'), bs('1'), bs('00'), bs('110'), bs('000000'), sd64, rd64], [rd64, sd64])
Severity: Major
Found in miasm/arch/aarch64/arch.py and 5 other locations - About 2 hrs to fix
miasm/arch/aarch64/arch.py on lines 2186..2186
miasm/arch/aarch64/arch.py on lines 2187..2187
miasm/arch/aarch64/arch.py on lines 2188..2188
miasm/arch/aarch64/arch.py on lines 2189..2189
miasm/arch/aarch64/arch.py on lines 2317..2317

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

aarch64op("fmov",  [bs('0'), bs('00'), bs('11110'), bs('00'), bs('1'), bs('00'), bs('111'), bs('000000'), rn32, sd32], [sd32, rn32])
Severity: Major
Found in miasm/arch/aarch64/arch.py and 5 other locations - About 2 hrs to fix
miasm/arch/aarch64/arch.py on lines 2186..2186
miasm/arch/aarch64/arch.py on lines 2188..2188
miasm/arch/aarch64/arch.py on lines 2189..2189
miasm/arch/aarch64/arch.py on lines 2190..2190
miasm/arch/aarch64/arch.py on lines 2317..2317

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            for j, imp in enumerate(entry.impbynames):
                if isinstance(imp, ImportByName):
                    raw[self.parent_head.rva2off(tmp_thunk[j].rva)] = bytes(imp)
Severity: Major
Found in miasm/loader/pe.py and 1 other location - About 2 hrs to fix
miasm/loader/pe.py on lines 1003..1005

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            for j, imp in enumerate(entry.impbynames):
                if isinstance(imp, ImportByName):
                    raw[self.parent_head.rva2off(tmp_thunk[j].rva)] = bytes(imp)
Severity: Major
Found in miasm/loader/pe.py and 1 other location - About 2 hrs to fix
miasm/loader/pe.py on lines 488..490

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

def sqrtss(_, instr, dst, src):
    e = []
    e.append(m2_expr.ExprAssign(dst[:32],
                             m2_expr.ExprOp('fsqrt',
                                            src[:32])))
Severity: Major
Found in miasm/arch/x86/sem.py and 6 other locations - About 2 hrs to fix
miasm/arch/x86/sem.py on lines 4239..4243
miasm/arch/x86/sem.py on lines 4246..4250
miasm/arch/x86/sem.py on lines 4267..4271
miasm/arch/x86/sem.py on lines 4274..4278
miasm/arch/x86/sem.py on lines 4281..4285
miasm/arch/x86/sem.py on lines 4752..4757

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if isinstance(fname, tuple):
                fname = b"%s_%d_symb" % (force_bytes(fname[0]), fname[1])
            else:
                fname = b"%s_symb" % force_bytes(fname)
Severity: Major
Found in miasm/analysis/dse.py and 1 other location - About 2 hrs to fix
miasm/analysis/dse.py on lines 269..272

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

def cvtss2sd(_, instr, dst, src):
    e = []
    e.append(
        m2_expr.ExprAssign(dst[:64], m2_expr.ExprOp('fpconvert_fp64', src[:32])))
    return e, []
Severity: Major
Found in miasm/arch/x86/sem.py and 6 other locations - About 2 hrs to fix
miasm/arch/x86/sem.py on lines 4239..4243
miasm/arch/x86/sem.py on lines 4246..4250
miasm/arch/x86/sem.py on lines 4267..4271
miasm/arch/x86/sem.py on lines 4281..4285
miasm/arch/x86/sem.py on lines 4752..4757
miasm/arch/x86/sem.py on lines 4760..4765

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 7 locations. Consider refactoring.
Open

def cvtss2si(_, instr, dst, src):
    e = []
    e.append(
        m2_expr.ExprAssign(dst[:32], m2_expr.ExprOp('fp_to_sint32', src[:32])))
    return e, []
Severity: Major
Found in miasm/arch/x86/sem.py and 6 other locations - About 2 hrs to fix
miasm/arch/x86/sem.py on lines 4239..4243
miasm/arch/x86/sem.py on lines 4246..4250
miasm/arch/x86/sem.py on lines 4267..4271
miasm/arch/x86/sem.py on lines 4274..4278
miasm/arch/x86/sem.py on lines 4752..4757
miasm/arch/x86/sem.py on lines 4760..4765

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    while ((max_char is None or l < max_char) and
           jitter.vm.get_mem(tmp, 2) != b"\x00\x00"):
        tmp += 2
        l += 2
Severity: Major
Found in miasm/os_dep/common.py and 2 other locations - About 2 hrs to fix
miasm/jitter/jitload.py on lines 486..489
miasm/os_dep/common.py on lines 16..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

@sbuild.parse
def b_ne(arg1):
    cond = cond2expr['NE']
    dst = arg1 if cond else ExprLoc(ir.get_next_loc_key(instr), 64)
    PC = dst
Severity: Major
Found in miasm/arch/aarch64/sem.py and 11 other locations - About 2 hrs to fix
miasm/arch/aarch64/sem.py on lines 1733..1738
miasm/arch/aarch64/sem.py on lines 1741..1746
miasm/arch/aarch64/sem.py on lines 1749..1754
miasm/arch/aarch64/sem.py on lines 1757..1762
miasm/arch/aarch64/sem.py on lines 1765..1770
miasm/arch/aarch64/sem.py on lines 1773..1778
miasm/arch/aarch64/sem.py on lines 1781..1786
miasm/arch/aarch64/sem.py on lines 1789..1794
miasm/arch/aarch64/sem.py on lines 1797..1802
miasm/arch/aarch64/sem.py on lines 1805..1810
miasm/arch/aarch64/sem.py on lines 1813..1818

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language