raise linpng size limit

By default libpng is limited to 1m pixels per axis. Raise this to
VIPS_MAX_COORD, ie. 10m pixels.
This commit is contained in:
John Cupitt 2022-01-13 11:44:28 +00:00
parent f75b3c1ee9
commit 6b475c92a2
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,7 @@
- remove stray trailing comma from iiif3 dirnames [whalehub]
- fix TTF load [chregu]
- revise GIF save alpha threshold [jfcalvo]
- raise libpng pixel size limit from 1m to 10m pixels [jskrzypek]
21/11/21 started 8.12.1
- fix insert [chregu]

View File

@ -83,6 +83,8 @@
* - read out background, if we can
* 29/8/21 joshuamsager
* - add "unlimited" flag to png load
* 13/1/22
* - raise libpng pixel size limit to VIPS_MAX_COORD
*/
/*
@ -304,6 +306,10 @@ read_new( VipsSource *source, VipsImage *out,
PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE );
#endif /*FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION*/
/* libpng has a default soft limit of 1m pixels per axis.
*/
png_set_user_limits( read->pPng, VIPS_MAX_COORD, VIPS_MAX_COORD );
if( vips_source_rewind( source ) )
return( NULL );
png_set_read_fn( read->pPng, read, vips_png_read_source );
@ -1046,7 +1052,8 @@ write_vips( Write *write,
if( vips_image_pio_input( in ) )
return( -1 );
}
if( compress < 0 || compress > 9 ) {
if( compress < 0 ||
compress > 9 ) {
vips_error( "vips2png",
"%s", _( "compress should be in [0,9]" ) );
return( -1 );
@ -1085,6 +1092,10 @@ write_vips( Write *write,
interlace_type = interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
/* libpng has a default soft limit of 1m pixels per axis.
*/
png_set_user_limits( write->pPng, VIPS_MAX_COORD, VIPS_MAX_COORD );
png_set_IHDR( write->pPng, write->pInfo,
in->Xsize, in->Ysize, bitdepth, color_type, interlace_type,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT );