mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 18:35:41 +01:00 
			
		
		
		
	pngdec: raise memory limit if needed
Some PNG input contain chunks larger than libpng's default memory-alloc limit (8M). Raise this limit reasonably if it looks like the input bitstream is larger than libpng's default limit. BUG=webp:497 Change-Id: I2c9fbed727424042444b82cbf15e0781cefb38dc
This commit is contained in:
		| @@ -259,6 +259,12 @@ int ReadPNG(const uint8_t* const data, size_t data_size, | ||||
|     goto End; | ||||
|   } | ||||
|  | ||||
|   // If it looks like the bitstream is going to need more memory than libpng's | ||||
|   // internal limit (default: 8M), try to (reasonably) raise it. | ||||
|   if (data_size > png_get_chunk_malloc_max(png) && data_size < (1u << 24)) { | ||||
|     png_set_chunk_malloc_max(png, data_size); | ||||
|   } | ||||
|  | ||||
|   info = png_create_info_struct(png); | ||||
|   if (info == NULL) goto Error; | ||||
|   end_info = png_create_info_struct(png); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user