mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Set counter to prevent additional attempts to cache a chunk
after running out of memory or reaching a potential overflow condition.
This commit is contained in:
7
pngmem.c
7
pngmem.c
@@ -123,7 +123,7 @@ png_malloc_array,(png_const_structrp png_ptr, int nelements,
|
||||
}
|
||||
|
||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||
png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
|
||||
png_realloc_array,(png_structrp png_ptr, png_const_voidp old_array,
|
||||
int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
|
||||
{
|
||||
/* These are internal errors: */
|
||||
@@ -154,6 +154,11 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
|
||||
}
|
||||
}
|
||||
|
||||
/* The potential overflow case. Set the cache counter so libpng will
|
||||
* not make any more attempts
|
||||
*/
|
||||
png_ptr->user_chunk_cache_max = 2;
|
||||
|
||||
return NULL; /* error */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user