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$')
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
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
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
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