hackedteam/fuzzer-windows

View on GitHub

Showing 193 of 193 total issues

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

            if t == 'kern':
                LOGGER.debug('parsing table kern')
                font_handle.seek(self.fontTableDirectories['kern'].offset)
                self.fontTableDirectories['kern'].table = KernTable(font_handle)   
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 211..214
fontfuzzer/parsers/TTF.py on lines 217..220
fontfuzzer/parsers/TTF.py on lines 224..227
fontfuzzer/parsers/TTF.py on lines 241..244

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 57.

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 row in res:
                    r = list(row)
                    r[5] = str(r[5]).split('.')[0]
                    availableResults.append(r)
Severity: Major
Found in fontfuzzer/hostagent.py and 1 other location - About 2 hrs to fix
fontfuzzer/hostagent.py on lines 317..320

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 57.

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

        class ClassTable():

            def __init__(self, handle):

                self.firstGlyph = unpack('>H', handle.read(2) )[0]
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 1 other location - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 1949..1953

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 57.

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

    class LongHorMetric():

        def __init__(self, handle):
            self.advanceWidth = unpack('>H', handle.read(2))[0]
            self.lsb = unpack('>h', handle.read(2))[0]
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 1 other location - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 2056..2061

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 57.

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 folder in os.listdir(fontsFolder):
                folder = os.path.join( fontsFolder, folder)
                if os.path.isdir( folder ):
                    availableFontsFolder.append( os.path.basename(folder))
Severity: Major
Found in fontfuzzer/hostagent.py and 1 other location - About 2 hrs to fix
fontfuzzer/serveragent.py on lines 80..83

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

Function gen_funcs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def gen_funcs():

    for i in iface_dict.keys():
        print "\n\nFUNCTIONS FOR %s \n\n" %i
Severity: Minor
Found in ie_sandbox/broker_trace/get_funcs.py - About 2 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

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

            for folder in os.listdir(fontsFolder):
                folder = os.path.join( fontsFolder, folder)
                if os.path.isdir( folder ):
                    availableFontsFolder.append( os.path.basename(folder))
Severity: Major
Found in fontfuzzer/serveragent.py and 1 other location - About 2 hrs to fix
fontfuzzer/hostagent.py on lines 419..422

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 in range(numwrites):
            rbyte = random.randrange(256)
            rn = random.randrange(len(fileInMemory))
            fileInMemory[rn] = "%c"%(rbyte);
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 1 other location - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 660..663

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 53.

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 in range(numwrites):
            rbyte = random.randrange(256)
            rn = random.randrange(len(fileInMemory))
            fileInMemory[rn] = "%c"%(rbyte);
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 1 other location - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 2398..2401

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 53.

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 5 locations. Consider refactoring.
Open

        for i in range(0, len(newFileInMemory), 4):
            data = unpack('>I', newFileInMemory[i:i+4])[0]
            total_data += data
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 782..784
fontfuzzer/parsers/TTF.py on lines 804..806
fontfuzzer/parsers/TTF.py on lines 866..868
fontfuzzer/parsers/TTF.py on lines 952..954

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 53.

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 5 locations. Consider refactoring.
Open

        for i in range(0, len(table), 4):
            data = unpack('>I', table[i:i+4] ) [0]
            total_data += data
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 782..784
fontfuzzer/parsers/TTF.py on lines 866..868
fontfuzzer/parsers/TTF.py on lines 952..954
fontfuzzer/parsers/TTF.py on lines 2304..2306

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 53.

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 5 locations. Consider refactoring.
Open

        for i in range(0, len(font), 4):
            data = unpack('>I', font[i:i+4] ) [0]
            total_data += data
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 782..784
fontfuzzer/parsers/TTF.py on lines 804..806
fontfuzzer/parsers/TTF.py on lines 866..868
fontfuzzer/parsers/TTF.py on lines 2304..2306

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 53.

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

Function fuzzBytecode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def fuzzBytecode(self, fileInMemory):

        print '[DD] Start fuzz GLYPH'

        if self.glyph.bytecodeStartFileOffset is None or self.glyph.bytecodeEndFileOffset is None:
Severity: Minor
Found in fontfuzzer/parsers/TTF.py - About 2 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

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

        for i in range(0, len(table), 4):
            data = unpack('>I', table[i:i+4] ) [0]
            total_data += data
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 804..806
fontfuzzer/parsers/TTF.py on lines 866..868
fontfuzzer/parsers/TTF.py on lines 952..954
fontfuzzer/parsers/TTF.py on lines 2304..2306

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 53.

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 5 locations. Consider refactoring.
Open

        for i in range(0, len(newFileInMemory), 4):
            data = unpack('>I', newFileInMemory[i:i+4])[0]
            total_data += data
Severity: Major
Found in fontfuzzer/parsers/TTF.py and 4 other locations - About 2 hrs to fix
fontfuzzer/parsers/TTF.py on lines 782..784
fontfuzzer/parsers/TTF.py on lines 804..806
fontfuzzer/parsers/TTF.py on lines 952..954
fontfuzzer/parsers/TTF.py on lines 2304..2306

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 53.

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

File serveragent.py has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

import os
import sys
import time
Severity: Minor
Found in fontfuzzer/serveragent.py - About 2 hrs to fix

    Function shortName has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def shortName(font):
    
        try:
    
            for record in font['name'].names:
    Severity: Minor
    Found in fontfuzzer/fuzzers/native_glyf.py - About 2 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 shortName has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def shortName(font):
        name = "default"
        family = "default"
    
        try:
    Severity: Minor
    Found in fontfuzzer/fuzzers/native_ben.py - About 2 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 rebuildFont has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def rebuildFont(self, tag, newTagTable, originalFontBuffer):
    
    
            assert len(originalFontBuffer) % 4 == 0, 'File must be 4 byte aligned'
            assert len(newTagTable) % 4 == 0, 'New table must be 4 byte aligned'
    Severity: Major
    Found in fontfuzzer/parsers/TTF.py - About 2 hrs to fix

      Function shortName has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def shortName(font):
          name = ""
          family = ""
      
          for record in font['name'].names:
      Severity: Minor
      Found in fontfuzzer/fuzzers_downloaded/native.py - About 1 hr 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