2019-02-28 12:28:09 +01:00
|
|
|
#include <vips/vips.h>
|
|
|
|
|
|
|
|
extern "C" int
|
|
|
|
LLVMFuzzerInitialize( int *argc, char ***argv )
|
|
|
|
{
|
|
|
|
vips_concurrency_set( 1 );
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int
|
|
|
|
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
|
|
|
{
|
2019-08-09 17:45:08 +02:00
|
|
|
VipsImage *image, *out;
|
2019-02-28 12:28:09 +01:00
|
|
|
double d;
|
|
|
|
|
2019-08-09 17:45:08 +02:00
|
|
|
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
|
2019-02-28 12:28:09 +01:00
|
|
|
return( 0 );
|
2019-08-02 17:28:16 +02:00
|
|
|
|
2019-08-09 17:45:08 +02:00
|
|
|
/* Skip big images. They are likely to timeout.
|
2019-08-02 17:28:16 +02:00
|
|
|
*/
|
2019-08-09 17:45:08 +02:00
|
|
|
if( image->Xsize > 1024 ||
|
|
|
|
image->Ysize > 1024 ||
|
|
|
|
image->Bands > 10 ) {
|
|
|
|
g_object_unref( image );
|
2019-08-02 17:28:16 +02:00
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
2019-08-09 17:45:08 +02:00
|
|
|
if( vips_sharpen( image, &out, NULL ) ) {
|
|
|
|
g_object_unref( image );
|
2019-02-28 12:28:09 +01:00
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
vips_avg( out, &d, NULL );
|
|
|
|
|
|
|
|
g_object_unref( out );
|
2019-08-09 17:45:08 +02:00
|
|
|
g_object_unref( image );
|
2019-02-28 12:28:09 +01:00
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|