2019-08-19 15:59:55 +02: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 )
|
|
|
|
{
|
|
|
|
VipsImage *image, *out;
|
|
|
|
double d;
|
|
|
|
|
2020-07-25 15:46:44 +02:00
|
|
|
if( size > 100 * 1024 * 1024 )
|
|
|
|
return( 0 );
|
|
|
|
|
2019-08-19 15:59:55 +02:00
|
|
|
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) )
|
|
|
|
return( 0 );
|
|
|
|
|
2019-10-30 09:57:46 +01:00
|
|
|
if( image->Xsize > 100 ||
|
|
|
|
image->Ysize > 100 ||
|
|
|
|
image->Bands > 4 ) {
|
2019-08-19 15:59:55 +02:00
|
|
|
g_object_unref( image );
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( vips_smartcrop( image, &out, 32, 32, NULL ) ) {
|
|
|
|
g_object_unref( image );
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
vips_min( out, &d, NULL );
|
|
|
|
|
|
|
|
g_object_unref( out );
|
|
|
|
g_object_unref( image );
|
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|