ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

Do not introduce global variables.
Open

        strArg = format('{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}', $gdasm.decode_dword(carg), ($gdasm.decode_dword(carg + 4) & 0xffff), ($gdasm.decode_dword(carg + 6) & 0xffff), $gdasm.decode_byte(carg + 8), $gdasm.decode_byte(carg + 9), $gdasm.decode_byte(carg + 10), $gdasm.decode_byte(carg + 11), $gdasm.decode_byte(carg + 12), $gdasm.decode_byte(carg + 13), $gdasm.decode_byte(carg + 14), $gdasm.decode_byte(carg + 15), $gdasm.decode_byte(carg + 16))

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Use @treeloop.zero? instead of @treeloop == 0.
Open

      if @treeloop == 0

This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

Example: EnforcedStyle: predicate (default)

# bad

foo == 0
0 > foo
bar.baz > 0

# good

foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad

foo.zero?
foo.negative?
bar.baz.positive?

# good

foo == 0
0 > foo
bar.baz > 0

Line is too long. [104/80]
Open

      comment += 'Top function : func_' + entrypoints[0].to_s(16) + "h_at_0x#{entrypoints[0].to_s(16)}_"

Line is too long. [185/80]
Open

        comment += ' -> ' + dasm.get_label_at(tramp.instruction.args.last.symbolic.target.bind.reduce).to_s if dasm.get_label_at(tramp.instruction.args.last.symbolic.target.bind.reduce)

Line is too long. [168/80]
Open

        comment += ' -> ' + dasm.di_at(tramp.instruction.args.last.symbolic.target.bind.reduce).to_s unless dasm.di_at(tramp.instruction.args.last.symbolic.target).nil?

Do not introduce global variables.
Open

  return 0 if $gdasm.read_raw_data(addr, 0x10).nil?

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Line is too long. [95/80]
Open

      comment += " #{dasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce)}("

Line is too long. [361/80]
Open

      comment += " 0x#{dasm.normalize(di.instruction.args.last).to_s(16)} = '#{((dasm.normalize(di.instruction.args.last) & 0xff).chr + ((dasm.normalize(di.instruction.args.last) & 0xff00) >> 8).chr + ((dasm.normalize(di.instruction.args.last) & 0xff0000) >> 16).chr + ((dasm.normalize(di.instruction.args.last) & 0xff000000) >> 24).chr).gsub(/[\x00]/n, ' ')}'"

Line is too long. [159/80]
Open

    if !dasm.get_label_at(dasm.normalize(di.instruction.args.last)).nil? && (dasm.get_label_at(dasm.normalize(di.instruction.args.last)).to_s[0..4] != 'xref_')

Line is too long. [82/80]
Open

      comment += 'a"' + argStr.gsub(/[\x0d]/n, '\\r').gsub(/[\x0a]/n, '\\n') + '"'

Line is too long. [86/80]
Open

        if (di.opcode.name == 'jmp') && !curblock.nil? && defined?(di.block.to_normal)

Line is too long. [321/80]
Open

      if ((di.block.list.last.address == di.address) && (((!di.block.to_normal.nil? && (di.block.to_normal.length > 1)) || di.block.to_normal.nil?) || (di.opcode.name[0] == 'j') || (!dasm.di_at(di.next_addr).block.from_normal.nil? && (dasm.di_at(di.next_addr).block.from_normal.length > 1)))) || (di.opcode.name == 'jmp')

Do not introduce global variables.
Open

  return di.to_s.gsub('\\', '\\\\\\').gsub('"', '\\"') if $SVG.nil?

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Do not introduce global variables.
Open

if defined?($GRAPH) && opts[:outfile]

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Line is too long. [138/80]
Open

    if defined?(di.instruction.args.last.symbolic.target) && !dasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce).nil?

Line is too long. [98/80]
Open

    if !argStr.nil? && (argStr.length > 4) && (argStr !~ /([\x7f-\xff]|[\x01-\x08]|[\x0b-\x1f])/n)

Line is too long. [119/80]
Open

        fd.puts '        "0x' + curblock.to_s(16) + '" [color="lightgray", label="' + cblock + '\\l"];' if cblock != ''

Line is too long. [118/80]
Open

          fd.puts '        "0x' + curblock.to_s(16) + '" -> "0x' + di.block.to_normal[1].to_s(16) + '" [color="red"];'

Line is too long. [317/80]
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#{call_stub.split('loc_')[1].split('h')[0]}\" stroke-width=\"0.7\" stroke=\"blue\" fill=\"blue\">#{call_stub}</a><a xlink:href=\"javascript:displayRenameBox(0x#{(call_stub.scan(/[a-f0-9]{3,}/))[1]});\" stroke-width=\"0.6\" stroke=\"#80c000\" fill=\"#80c000\">[R]</a>")

Line is too long. [169/80]
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#\" stroke-width=\"0.7\" stroke=\"red\" fill=\"red\">#{call_stub.split('(')[0]}<!-- --></a>(#{call_stub.split('(')[1]}")
Severity
Category
Status
Source
Language