band large image during fuzzing

Large images cause a lot of uninteresting OOMs and timeouts during
fuzzing. Ban them.
This commit is contained in:
John Cupitt 2019-08-02 10:53:32 +01:00
parent 0a225314b9
commit 0accdf858b
1 changed files with 11 additions and 0 deletions

View File

@ -382,6 +382,17 @@ int
vips_image_pipeline_array( VipsImage *image,
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
* 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