diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2016-11-08 09:50:00 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2016-11-22 09:49:30 +0000 |
commit | 6655712ee1d0bf2a7818044613bbed226b7abddd (patch) | |
tree | 14ed7439e7962421bcb26e7f72cac77c679cd0a5 /freetype/src/tools/ftfuzzer/runinput.cc | |
parent | 99c6a18eb430a9091c79369b2bdd2952d481c7d5 (diff) | |
download | ghostpdl-6655712ee1d0bf2a7818044613bbed226b7abddd.tar.gz |
Update freetype to 2.7.0
Tweak makefile for new freetype version
Force use of the v35 Freetype bytecode interpreter
Diffstat (limited to 'freetype/src/tools/ftfuzzer/runinput.cc')
-rw-r--r-- | freetype/src/tools/ftfuzzer/runinput.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/freetype/src/tools/ftfuzzer/runinput.cc b/freetype/src/tools/ftfuzzer/runinput.cc new file mode 100644 index 000000000..d5f9f1587 --- /dev/null +++ b/freetype/src/tools/ftfuzzer/runinput.cc @@ -0,0 +1,58 @@ +// runinput.cc +// +// A `main' function for fuzzers like `ftfuzzer.cc'. +// +// Copyright 2015-2016 by +// David Turner, Robert Wilhelm, and Werner Lemberg. +// +// This file is part of the FreeType project, and may only be used, +// modified, and distributed under the terms of the FreeType project +// license, LICENSE.TXT. By continuing to use, modify, or distribute +// this file you indicate that you have read the license and +// understand and accept it fully. + + +#include <assert.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> + + + extern "C" void + LLVMFuzzerTestOneInput( const uint8_t* data, + size_t size ); + + + unsigned char a[1 << 24]; + + + int + main( int argc, + char* *argv ) + { + assert( argc >= 2 ); + + for ( int i = 1; i < argc; i++ ) + { + fprintf( stderr, "%s\n", argv[i] ); + + FILE* f = fopen( argv[i], "r" ); + assert( f ); + + size_t n = fread( a, 1, sizeof ( a ), f ); + fclose( f ); + if ( !n ) + continue; + + unsigned char* b = (unsigned char*)malloc( n ); + memcpy( b, a, n ); + + LLVMFuzzerTestOneInput( b, n ); + + free( b ); + } + } + + +// END |