also set png max chunk malloc when reading buffer

This commit is contained in:
Matt Drollette 2019-09-10 12:31:11 -05:00
parent 7b2729adfa
commit e233698c2b
1 changed files with 6 additions and 0 deletions

View File

@ -812,7 +812,13 @@ read_new_buffer( VipsImage *out, const void *buffer, size_t length,
/* Read enough of the file that png_get_interlace_type() will start
* working.
*
* By default, libpng refuses to open files with a metadata chunk
* larger than 8mb. We've seen real files with 20mb, so set 50mb.
*/
#ifdef HAVE_PNG_SET_CHUNK_MALLOC_MAX
png_set_chunk_malloc_max( read->pPng, 50 * 1024 * 1024 );
#endif /*HAVE_PNG_SET_CHUNK_MALLOC_MAX*/
png_read_info( read->pPng, read->pInfo );
return( read );