skip large images in the fuzzers not in the lib
This reverts commit 0accdf858b
.
This commit is contained in:
parent
4ce745dbee
commit
45de60e571
@ -11,13 +11,24 @@ extern "C" int
|
|||||||
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
size_t len;
|
|
||||||
void *buf;
|
void *buf;
|
||||||
|
size_t len, width, height, bands;
|
||||||
|
|
||||||
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = image->Xsize;
|
||||||
|
height = image->Ysize;
|
||||||
|
bands = image->Bands;
|
||||||
|
|
||||||
|
/* Skip big images. It is likely to timeout.
|
||||||
|
*/
|
||||||
|
if ( width * height * bands > 256 * 256 * 16 ) {
|
||||||
|
g_object_unref( image );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_jpegsave_buffer( image, &buf, &len, NULL ) ) {
|
if( vips_jpegsave_buffer( image, &buf, &len, NULL ) ) {
|
||||||
g_object_unref( image );
|
g_object_unref( image );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -12,12 +12,23 @@ LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t len;
|
size_t len, width, height, bands;
|
||||||
|
|
||||||
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = image->Xsize;
|
||||||
|
height = image->Ysize;
|
||||||
|
bands = image->Bands;
|
||||||
|
|
||||||
|
/* Skip big images. It is likely to timeout.
|
||||||
|
*/
|
||||||
|
if ( width * height * bands > 256 * 256 * 16 ) {
|
||||||
|
g_object_unref( image );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_pngsave_buffer( image, &buf, &len, NULL ) ) {
|
if( vips_pngsave_buffer( image, &buf, &len, NULL ) ) {
|
||||||
g_object_unref( image );
|
g_object_unref( image );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -11,12 +11,24 @@ extern "C" int
|
|||||||
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
||||||
{
|
{
|
||||||
VipsImage *in, *out;
|
VipsImage *in, *out;
|
||||||
|
size_t width, height, bands;
|
||||||
double d;
|
double d;
|
||||||
|
|
||||||
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = in->Xsize;
|
||||||
|
height = in->Ysize;
|
||||||
|
bands = in->Bands;
|
||||||
|
|
||||||
|
/* Skip big images. It is likely to timeout.
|
||||||
|
*/
|
||||||
|
if ( width * height * bands > 256 * 256 * 16 ) {
|
||||||
|
g_object_unref( in );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_sharpen( in, &out, NULL ) ) {
|
if( vips_sharpen( in, &out, NULL ) ) {
|
||||||
g_object_unref( in );
|
g_object_unref( in );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -11,7 +11,7 @@ extern "C" int
|
|||||||
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
||||||
{
|
{
|
||||||
VipsImage *in, *out;
|
VipsImage *in, *out;
|
||||||
size_t width, height;
|
size_t width, height, bands;
|
||||||
double d;
|
double d;
|
||||||
|
|
||||||
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
if( !(in = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
||||||
@ -20,10 +20,11 @@ LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
|||||||
|
|
||||||
width = in->Xsize;
|
width = in->Xsize;
|
||||||
height = in->Ysize;
|
height = in->Ysize;
|
||||||
|
bands = in->Bands;
|
||||||
|
|
||||||
/* Skip big images. It is likely to timeout.
|
/* Skip big images. It is likely to timeout.
|
||||||
*/
|
*/
|
||||||
if ( width * height > 256 * 256 ) {
|
if ( width * height * bands > 256 * 256 * 16 ) {
|
||||||
g_object_unref( in );
|
g_object_unref( in );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,23 @@ LLVMFuzzerTestOneInput( const guint8 *data, size_t size )
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t len;
|
size_t len, width, height, bands;
|
||||||
|
|
||||||
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
if( !(image = vips_image_new_from_buffer( data, size, "", NULL )) ) {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = image->Xsize;
|
||||||
|
height = image->Ysize;
|
||||||
|
bands = image->Bands;
|
||||||
|
|
||||||
|
/* Skip big images. It is likely to timeout.
|
||||||
|
*/
|
||||||
|
if ( width * height * bands > 256 * 256 * 16 ) {
|
||||||
|
g_object_unref( image );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_webpsave_buffer( image, &buf, &len, NULL ) ) {
|
if( vips_webpsave_buffer( image, &buf, &len, NULL ) ) {
|
||||||
g_object_unref( image );
|
g_object_unref( image );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -382,17 +382,6 @@ int
|
|||||||
vips_image_pipeline_array( VipsImage *image,
|
vips_image_pipeline_array( VipsImage *image,
|
||||||
VipsDemandStyle hint, VipsImage **in )
|
VipsDemandStyle hint, VipsImage **in )
|
||||||
{
|
{
|
||||||
/* Ban large images while we are fuzzing. They cause unintersting
|
|
||||||
* timeouts and OOMs.
|
|
||||||
*/
|
|
||||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
||||||
if( (size_t) image->Xsize * image->Ysize * image->Bands > 1000000 ) {
|
|
||||||
vips_error( "vips_image_pipeline_array",
|
|
||||||
"%s", _( "no large images during fuzzing" ) );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
#endif /*FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION*/
|
|
||||||
|
|
||||||
/* This function can be called more than once per output image. For
|
/* This function can be called more than once per output image. For
|
||||||
* example, jpeg header load will call this once on ->out to set the
|
* example, jpeg header load will call this once on ->out to set the
|
||||||
* default hint, then later call it again to connect the output image
|
* default hint, then later call it again to connect the output image
|
||||||
|
Loading…
Reference in New Issue
Block a user