Commit bc976e57 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/utils: Fix potential overflow in overallocation code

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9ea81fe9
......@@ -127,7 +127,7 @@ static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size,
void **p = ptr;
if (min_size <= *size && *p)
return 0;
min_size = FFMAX(17 * min_size / 16 + 32, min_size);
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
av_free(*p);
*p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);
if (!*p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment