[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:
Glenn Randers-Pehrson
2013-01-21 16:37:54 -06:00
parent 8aee43d10a
commit 5e8ba1cbbf
5 changed files with 22 additions and 15 deletions

View File

@@ -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 */
}