예제 #1
0
def setupProject(project):
    for filename in FILENAMES:
        if path_exists(filename):
            continue
        raise ValueError("File doesn't exist: %s! Fix FILENAMES constant" %
                         filename)

    module_name = project.application().getInputFilename(
        'Module name (use "ALL" to test all modules)')

    project.error("Use python interpreter: %s" % PYTHON)
    project.error("Use filenames: %s" % ', '.join(FILENAMES))

    source = PythonSource(project, module_name)
    process = PythonProcess(project, [PYTHON, '-u', '<source.py>'],
                            timeout=10.0,
                            stdin='null')
    WatchProcess(process, exitcode_score=0)

    stdout = WatchStdout(process)
    stdout.max_nb_line = (1000, 1.0)

    # Disable dummy error messages
    stdout.words = {
        'oops': 0.30,
        'bug': 0.30,
        'memory': 0.40,
        'overflow': 0.40,
        'fatal': 1.0,
        'assert': 1.0,
        'assertion': 1.0,
        'critical': 1.0,
        'panic': 1.0,
        'glibc detected': 1.0,
        'segfault': 1.0,
        'segmentation fault': 1.0,
    }

    # PyPy messages
    stdout.addRegex("Fatal RPython error", 1.0)

    if DEBUG:
        stdout.show_matching = True
        stdout.show_not_matching = True
예제 #2
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("OGG/Vorbis file")
    mangle = OggMangle(project, orig_filename)
    if not INCR_MANGLE:
        mangle.hard_min_op = 1
        mangle.hard_max_op = 100
    else:
        from fusil.incr_mangle_op import InverseBit, Increment
        mangle.operations = (InverseBit, Increment)
    mangle.max_filesize = FILESIZE

    process = OggProcess(project, COMMAND, timeout=60.0)
    process.env.copy('HOME')

    if COMMAND[0] == 'ogg123':
        WatchProcess(process, exitcode_score=-0.25)
    else:
        WatchProcess(process, exitcode_score=0)
    stdout = WatchStdout(process)
    if True:
        #    stdout.max_nb_line = (5000, 1.0)
        stdout.show_matching = True
        stdout.show_not_matching = True
        stdout.addRegex(r"The file may be corrupted", -0.50)
        stdout.addRegex(r"Corrupted ogg", -0.50)
        stdout.addRegex(r"Could not decode vorbis header packet", -0.50)
        #    stdout.ignoreRegex('^Warning: Could not decode vorbis header packet')
        stdout.ignoreRegex('^Warning: sequence number gap')
        stdout.ignoreRegex('^New logical stream.*: type invalid$')
예제 #3
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("OGG/Vorbis file")
    mangle = OggMangle(project, orig_filename)
    if not INCR_MANGLE:
        mangle.hard_min_op = 1
        mangle.hard_max_op = 100
    else:
        from fusil.incr_mangle_op import InverseBit, Increment
        mangle.operations = (InverseBit, Increment)
    mangle.max_filesize = FILESIZE

    process = OggProcess(project, COMMAND, timeout=60.0)
    process.env.copy('HOME')

    if COMMAND[0] == 'ogg123':
        WatchProcess(process, exitcode_score=-0.25)
    else:
        WatchProcess(process, exitcode_score=0)
    stdout = WatchStdout(process)
    if True:
    #    stdout.max_nb_line = (5000, 1.0)
        stdout.show_matching = True
        stdout.show_not_matching = True
        stdout.addRegex(r"The file may be corrupted", -0.50)
        stdout.addRegex(r"Corrupted ogg", -0.50)
        stdout.addRegex(r"Could not decode vorbis header packet", -0.50)
    #    stdout.ignoreRegex('^Warning: Could not decode vorbis header packet')
        stdout.ignoreRegex('^Warning: sequence number gap')
        stdout.ignoreRegex('^New logical stream.*: type invalid$')
예제 #4
0
def setupProject(project):
    orig_filename = project.application().getInputFilename("JPEG picture")
    if INCR_MANGLE:
        mangle = IncrMangle(project, orig_filename)
        mangle.operation_per_version = 25
        mangle.max_version = 50
#        mangle.min_offset = 2
#        mangle.max_offset = 555
    else:
        AutoMangle(project, orig_filename)

    process = IdentifyProcess(project,
        ['exif', "<picture>"])
    WatchProcess(process,
#        exitcode_score=-0.50,
        exitcode_score=0,
    )

    stdout = WatchStdout(process)
    stdout.min_nb_line = (3, -0.5)
    stdout.words['error'] = 0.10
    # "Color Space         |Internal error (unknown value 4097)." is not a fatal error
#    stdout.ignoreRegex(r'Internal error \(unknown value')
#    stdout.addRegex(r'^Corrupt data', -1.0)
#    stdout.addRegex(r'does not contain EXIF data!$', -1.0)
    stdout.addRegex(r'The data supplied does not seem to contain EXIF data.$', -1.0)
    stdout.addRegex(r'does not contain EXIF data!$', -1.0)
    stdout.addRegex(r'^Unknown encoding\.$', -1.0)
    if DEBUG:
        stdout.show_not_matching = True
예제 #5
0
def setupProject(project):
    for filename in FILENAMES:
        if path_exists(filename):
            continue
        raise ValueError("File doesn't exist: %s! Fix FILENAMES constant" % filename)

    module_name = project.application().getInputFilename('Module name (use "ALL" to test all modules)')

    project.error("Use python interpreter: %s" % PYTHON)
    project.error("Use filenames: %s" % ', '.join(FILENAMES))

    source = PythonSource(project, module_name)
    process = PythonProcess(project, [PYTHON, '-u', '<source.py>'], timeout=10.0, stdin='null')
    WatchProcess(process, exitcode_score=0)

    stdout = WatchStdout(process)
    stdout.max_nb_line = (1000, 1.0)

    # Disable dummy error messages
    stdout.words = {
        'oops': 0.30,
        'bug': 0.30,
        'memory': 0.40,
        'overflow': 0.40,
        'fatal': 1.0,
        'assert': 1.0,
        'assertion': 1.0,
        'critical': 1.0,
        'panic': 1.0,
        'glibc detected': 1.0,
        'segfault': 1.0,
        'segmentation fault': 1.0,
    }

    # PyPy messages
    stdout.addRegex("Fatal RPython error", 1.0)

    if DEBUG:
        stdout.show_matching = True
        stdout.show_not_matching = True
예제 #6
0
def setupProject(project):
    global CMDLINE_ARG_POS
    orig_filename = project.application().getInputFilename("Image")
    mangle = ImageMangle(project, orig_filename)
    if INCR_MANGLE:
        mangle.operation_per_version = 1
        mangle.max_version = 50
    else:
        mangle.fixed_size_factor = 0.5

    options = {'timeout': 2.0}
    if USE_CONVERT:
        cmdline = ['convert', '<source>', '/tmp/output.bmp']
        CMDLINE_ARG_POS = 1
    else:
        cmdline = ['identify', '-verbose', '<source>']
        CMDLINE_ARG_POS = -1
    if not USE_STDOUT:
        options['stdout'] = 'null'
    process = IdentifyProcess(project, cmdline, **options)
    options = {'exitcode_score': -0.25}
    if orig_filename.endswith(".jpg"):
        # Don't care about libjpeg stdout flooding
        options['timeout_score'] = -0.25
    WatchProcess(process, **options)

    if USE_STDOUT:
        stdout = WatchStdout(process)
        stdout.max_nb_line = (3000, 0.20)
        stdout.patterns['memory allocation failed'] = 1.0
        stdout.patterns['no decode delegate for this image format'] = -1.0
        stdout.addRegex('Corrupt', 0.05)
        stdout.addRegex('Unsupported', 0.05)
        stdout.addRegex('Not a JPEG file', -0.50)
        stdout.addRegex('JPEG datastream contains no image', -0.50)
        stdout.show_not_matching = False
예제 #7
0
def setupProject(project):
    # Command line
    MAX_FILESIZE = 1*1024*1024
    ARGUMENTS = ['-quiet']
    MPLAYER_BIN = 'mplayer'
    NULL_VIDEO = True
    if NULL_VIDEO:
        ARGUMENTS.extend(['-vo', 'null', '-ao', 'null'])
    if True:
        SECONDS = 5
        TIMEOUT = SECONDS + 1.0
        ARGUMENTS.extend(['-endpos', str(SECONDS)])
    else:
        TIMEOUT = 7.0

    # Create buggy input file
    orig_filename = project.application().getInputFilename("Audio or video file")
    mangle = AutoMangle(project, orig_filename)
    mangle.max_size = MAX_FILESIZE

    process = MplayerProcess(project,
        [MPLAYER_BIN] + ARGUMENTS + ["<movie_filename>"],
        timeout=TIMEOUT)
    if not NULL_VIDEO:
        setupX11Process(process)
    else:
        process.env.copy('HOME')
    watch = WatchProcess(process, timeout_score=0)
    if watch.cpu:
        watch.cpu.weight = 0.20
        watch.cpu.max_load = 0.50
        watch.cpu.max_duration = min(3, TIMEOUT-0.5)
        watch.cpu.max_score = 0.50

    stdout = WatchStdout(process)

    # Ignore input errors
    stdout.ignoreRegex('^Failed to open LIRC support')
    stdout.ignoreRegex("^Can't init input joystick$")
    stdout.ignoreRegex("^Can't open joystick device ")

    # Ignore codec loading errors
    stdout.ignoreRegex('^Failed to create DirectShow filter$')
    stdout.ignoreRegex('^Win32 LoadLibrary failed')
    stdout.ignoreRegex('^Error loading dll$')
    stdout.ignoreRegex('^ERROR: Could not open required DirectShow codec ')
    stdout.ignoreRegex("could not open DirectShow")

    # Ignore other errors
    stdout.ignoreRegex("^Terminal type `unknown' is not defined.$")
    stdout.ignoreRegex('^VDecoder init failed')
    stdout.ignoreRegex("Read error at pos\. [0-9]+")
    stdout.ignoreRegex("could not connect to socket")
    stdout.ignoreRegex('^ADecoder init failed')
    stdout.ignoreRegex('^error while decoding block:')
    stdout.ignoreRegex('^Error while decoding frame!$')
    stdout.ignoreRegex('^\[(mpeg4|msmpeg4|wmv1|h264|NULL) @ ')

    stdout.patterns['overflow'] = 0.10
#    stdout.words['error'] = 0.10
#    stdout.words["can't"] = 0
    stdout.addRegex('MPlayer interrupted by signal', 1.0)
    stdout.addRegex('AVI: Missing video stream', -0.50)
    stdout.max_nb_line = None

    # Restore terminal state
    TerminalEcho(project)
예제 #8
0
def setupProject(project):
    # Command line
    MAX_FILESIZE = 1 * 1024 * 1024
    ARGUMENTS = ['-quiet']
    MPLAYER_BIN = 'mplayer'
    NULL_VIDEO = True
    if NULL_VIDEO:
        ARGUMENTS.extend(['-vo', 'null', '-ao', 'null'])
    if True:
        SECONDS = 5
        TIMEOUT = SECONDS + 1.0
        ARGUMENTS.extend(['-endpos', str(SECONDS)])
    else:
        TIMEOUT = 7.0

    # Create buggy input file
    orig_filename = project.application().getInputFilename(
        "Audio or video file")
    mangle = AutoMangle(project, orig_filename)
    mangle.max_size = MAX_FILESIZE

    process = MplayerProcess(project,
                             [MPLAYER_BIN] + ARGUMENTS + ["<movie_filename>"],
                             timeout=TIMEOUT)
    if not NULL_VIDEO:
        setupX11Process(process)
    else:
        process.env.copy('HOME')
    watch = WatchProcess(process, timeout_score=0)
    if watch.cpu:
        watch.cpu.weight = 0.20
        watch.cpu.max_load = 0.50
        watch.cpu.max_duration = min(3, TIMEOUT - 0.5)
        watch.cpu.max_score = 0.50

    stdout = WatchStdout(process)

    # Ignore input errors
    stdout.ignoreRegex('^Failed to open LIRC support')
    stdout.ignoreRegex("^Can't init input joystick$")
    stdout.ignoreRegex("^Can't open joystick device ")

    # Ignore codec loading errors
    stdout.ignoreRegex('^Failed to create DirectShow filter$')
    stdout.ignoreRegex('^Win32 LoadLibrary failed')
    stdout.ignoreRegex('^Error loading dll$')
    stdout.ignoreRegex('^ERROR: Could not open required DirectShow codec ')
    stdout.ignoreRegex("could not open DirectShow")

    # Ignore other errors
    stdout.ignoreRegex("^Terminal type `unknown' is not defined.$")
    stdout.ignoreRegex('^VDecoder init failed')
    stdout.ignoreRegex("Read error at pos\. [0-9]+")
    stdout.ignoreRegex("could not connect to socket")
    stdout.ignoreRegex('^ADecoder init failed')
    stdout.ignoreRegex('^error while decoding block:')
    stdout.ignoreRegex('^Error while decoding frame!$')
    stdout.ignoreRegex('^\[(mpeg4|msmpeg4|wmv1|h264|NULL) @ ')

    stdout.patterns['overflow'] = 0.10
    #    stdout.words['error'] = 0.10
    #    stdout.words["can't"] = 0
    stdout.addRegex('MPlayer interrupted by signal', 1.0)
    stdout.addRegex('AVI: Missing video stream', -0.50)
    stdout.max_nb_line = None

    # Restore terminal state
    TerminalEcho(project)
예제 #9
0
def setupProject(project):
    TIMEOUT = 4
    GST_LAUNCH_BIN = 'gst-launch-0.10'
    USE_DECODEBIN = True
    NO_AUDIO = True
    NO_VIDEO = True

    # Profile parameters
    AUDIO_SINK = "alsasink"
    VIDEO_SINK = "xvimagesink"
    if NO_AUDIO:
        AUDIO_SINK = "fakesink"
    if NO_VIDEO:
        VIDEO_SINK = "fakesink"

    # Create buggy input file
    orig_filename = project.application().getInputFilename("Audio or video file")
    if INCR_MANGLE:
        mangle = IncrMangle(project, orig_filename)
        mangle.max_size = 50*1024
        # OGG
        #mangle.operation_per_version = 10
        #mangle.max_version = 100
        # WAVE
        #mangle.operation_per_version = 100
        #mangle.max_version = 30
        # AVI
        mangle.operation_per_version = 500
        mangle.max_version = 50
    else:
        mangle = AutoMangle(project, orig_filename)
        mangle.hard_max_op = 500
        mangle.max_size = 10*1024*1024

    if USE_DECODEBIN:
        # -f option: Do not install a fault handler
        arguments = [GST_LAUNCH_BIN, '-f',
            "filesrc", "location=<filename>", "!", "decodebin", "name=decoder",
            "decoder.", "!", "queue", "!", "audioconvert", "!", "audioresample", "!", AUDIO_SINK]
        if isVideo(orig_filename):
            arguments.extend(["decoder.", "!", "ffmpegcolorspace", "!", VIDEO_SINK])

        class GstreamerProcess(CreateProcess):
            def on_mangle_filenames(self, movie_filenames):
                self.cmdline.arguments[3] = 'location=' + movie_filenames[0]
                self.createProcess()
    else:
        arguments = [GST_LAUNCH_BIN, '-f', 'playbin', 'uri=file://<playbin_uri>']

        class GstreamerProcess(CreateProcess):
            def on_mangle_filenames(self, movie_filenames):
                self.cmdline.arguments[3] = 'uri=file://%s' % movie_filenames[0]
                self.createProcess()

    process = GstreamerProcess(project, arguments, timeout=TIMEOUT)

    WatchProcess(process, exitcode_score=0.20, timeout_score=0.20)
    #, timeout_score=0)
    setupX11Process(process)

    stdout = WatchStdout(process)
    stdout.words['error'] = 0.10
    stdout.words['critical'] = 0.30
    del stdout.words['assertion']
    stdout.addRegex(r'Could not decode stream\.$', -1.0)
    stdout.addRegex(r'Could not (?:decode stream|determine type of stream|demultiplex stream)\.$', -1.0)
    stdout.addRegex(r'The stream is of a different type than handled by this element\.$', -1.0)
    stdout.addRegex(r'You might need to install the necessary plugins', 1.0)
    stdout.score_weight = 0.40