Don't fail if PNG contains too much text chunks (#2803)

Only warn if PNG contains too many text chunks

Update spngload.c
This commit is contained in:
Sergey Alexandrovich 2022-05-15 17:18:06 +06:00 committed by GitHub
parent 7561d4e52c
commit 982cbe5f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -258,9 +258,9 @@ vips_foreign_load_png_set_header( VipsForeignLoadPng *png, VipsImage *image )
*/
if( !png->unlimited && n_text > MAX_PNG_TEXT_CHUNKS ) {
vips_error( class->nickname,
"%s", _( "too many text chunks" ) );
return( -1 );
g_warning(_( "%d text chunks, only %d text chunks will be loaded" ),
n_text, MAX_PNG_TEXT_CHUNKS );
n_text = MAX_PNG_TEXT_CHUNKS;
}
text = VIPS_ARRAY( VIPS_OBJECT( png ),

View File

@ -581,10 +581,9 @@ png2vips_header( Read *read, VipsImage *out )
*/
if( !read->unlimited &&
num_text > MAX_PNG_TEXT_CHUNKS ) {
vips_error( "vipspng",
_( "%d text chunks, image blocked" ),
num_text );
return( -1 );
g_warning(_( "%d text chunks, only %d text chunks will be loaded" ),
num_text, MAX_PNG_TEXT_CHUNKS );
num_text = MAX_PNG_TEXT_CHUNKS;
}
for( i = 0; i < num_text; i++ )