# HG changeset patch # User michael # Date 1206440117 0 # Node ID 8aafb712389ef61834b1549da3347824fca900ce # Parent 7781f4e99d3749d96beed489e9a9165494eaf8ff Fix possible heap overflow caused by av_fast_realloc() diff -r 7781f4e99d37 -r 8aafb712389e utils.c --- a/utils.c Mon Mar 24 22:25:30 2008 +0000 +++ b/utils.c Tue Mar 25 10:15:17 2008 +0000 @@ -66,7 +66,11 @@ *size= FFMAX(17*min_size/16 + 32, min_size); - return av_realloc(ptr, *size); + ptr= av_realloc(ptr, *size); + if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now + *size= 0; + + return ptr; } static unsigned int last_static = 0;