Merge pull request #1424 from OrderMyGear/png-max-malloc-buffer

also set png max chunk malloc when reading buffer
This commit is contained in:
John Cupitt 2019-09-11 14:22:33 +01:00 committed by GitHub
commit 64898330e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 );