small cleanups from "unlimited" option
This commit is contained in:
parent
bb88490a17
commit
451cfcd282
@ -1,5 +1,6 @@
|
|||||||
16/8/21 started 8.11.4
|
16/8/21 started 8.11.4
|
||||||
- fix off-by-one error in new rank fast path
|
- fix off-by-one error in new rank fast path
|
||||||
|
- add "unlimited" flag to png load [joshuamsager]
|
||||||
|
|
||||||
14/7/21 started 8.11.3
|
14/7/21 started 8.11.3
|
||||||
- build threadpool later [kleisauke]
|
- build threadpool later [kleisauke]
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
*
|
*
|
||||||
* 5/12/11
|
* 5/12/11
|
||||||
* - from tiffload.c
|
* - from tiffload.c
|
||||||
|
* 29/8/21 joshuamsager
|
||||||
|
* - add "unlimited" flag to png load
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -133,7 +135,8 @@ vips_foreign_load_png_load( VipsForeignLoad *load )
|
|||||||
{
|
{
|
||||||
VipsForeignLoadPng *png = (VipsForeignLoadPng *) load;
|
VipsForeignLoadPng *png = (VipsForeignLoadPng *) load;
|
||||||
|
|
||||||
if( vips__png_read_source( png->source, load->real, load->fail, png->unlimited ) )
|
if( vips__png_read_source( png->source, load->real,
|
||||||
|
load->fail, png->unlimited ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
* - from pngload.c
|
* - from pngload.c
|
||||||
* 19/2/21 781545872
|
* 19/2/21 781545872
|
||||||
* - read out background, if we can
|
* - read out background, if we can
|
||||||
|
* 29/8/21 joshuamsager
|
||||||
|
* - add "unlimited" flag to png load
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -354,8 +356,10 @@ vips_foreign_load_png_header( VipsForeignLoad *load )
|
|||||||
* they wish.
|
* they wish.
|
||||||
*/
|
*/
|
||||||
if ( !png->unlimited ) {
|
if ( !png->unlimited ) {
|
||||||
spng_set_image_limits( png->ctx, VIPS_MAX_COORD, VIPS_MAX_COORD );
|
spng_set_image_limits( png->ctx,
|
||||||
spng_set_chunk_limits( png->ctx, 60 * 1024 * 1024, 60 * 1024 * 1024 );
|
VIPS_MAX_COORD, VIPS_MAX_COORD );
|
||||||
|
spng_set_chunk_limits( png->ctx,
|
||||||
|
60 * 1024 * 1024, 60 * 1024 * 1024 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vips_source_rewind( png->source ) )
|
if( vips_source_rewind( png->source ) )
|
||||||
|
@ -81,6 +81,8 @@
|
|||||||
* - only warn for saving bad profiles, don't fail
|
* - only warn for saving bad profiles, don't fail
|
||||||
* 19/2/21 781545872
|
* 19/2/21 781545872
|
||||||
* - read out background, if we can
|
* - read out background, if we can
|
||||||
|
* 29/8/21 joshuamsager
|
||||||
|
* - add "unlimited" flag to png load
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -256,7 +258,8 @@ vips_png_read_source( png_structp pPng, png_bytep data, png_size_t length )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Read *
|
static Read *
|
||||||
read_new( VipsSource *source, VipsImage *out, gboolean fail, gboolean unlimited )
|
read_new( VipsSource *source, VipsImage *out,
|
||||||
|
gboolean fail, gboolean unlimited )
|
||||||
{
|
{
|
||||||
Read *read;
|
Read *read;
|
||||||
|
|
||||||
@ -564,7 +567,8 @@ png2vips_header( Read *read, VipsImage *out )
|
|||||||
/* Very large numbers of text chunks are used in DoS
|
/* Very large numbers of text chunks are used in DoS
|
||||||
* attacks.
|
* attacks.
|
||||||
*/
|
*/
|
||||||
if( !read->unlimited && num_text > MAX_PNG_TEXT_CHUNKS ) {
|
if( !read->unlimited &&
|
||||||
|
num_text > MAX_PNG_TEXT_CHUNKS ) {
|
||||||
vips_error( "vipspng",
|
vips_error( "vipspng",
|
||||||
"%s", _( "too many text chunks" ) );
|
"%s", _( "too many text chunks" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
@ -778,7 +782,8 @@ vips__png_ispng_source( VipsSource *source )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips__png_header_source( VipsSource *source, VipsImage *out, gboolean unlimited )
|
vips__png_header_source( VipsSource *source, VipsImage *out,
|
||||||
|
gboolean unlimited )
|
||||||
{
|
{
|
||||||
Read *read;
|
Read *read;
|
||||||
|
|
||||||
@ -795,7 +800,8 @@ vips__png_header_source( VipsSource *source, VipsImage *out, gboolean unlimited
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vips__png_read_source( VipsSource *source, VipsImage *out, gboolean fail, gboolean unlimited )
|
vips__png_read_source( VipsSource *source, VipsImage *out,
|
||||||
|
gboolean fail, gboolean unlimited )
|
||||||
{
|
{
|
||||||
Read *read;
|
Read *read;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user