comparison utils.c @ 6532:8aafb712389e libavcodec

Fix possible heap overflow caused by av_fast_realloc()
author michael
date Tue, 25 Mar 2008 10:15:17 +0000
parents ecbe9565dcae
children fb6109c5f08b
comparison
equal deleted inserted replaced
6531:7781f4e99d37 6532:8aafb712389e
64 if(min_size < *size) 64 if(min_size < *size)
65 return ptr; 65 return ptr;
66 66
67 *size= FFMAX(17*min_size/16 + 32, min_size); 67 *size= FFMAX(17*min_size/16 + 32, min_size);
68 68
69 return av_realloc(ptr, *size); 69 ptr= av_realloc(ptr, *size);
70 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
71 *size= 0;
72
73 return ptr;
70 } 74 }
71 75
72 static unsigned int last_static = 0; 76 static unsigned int last_static = 0;
73 static unsigned int allocated_static = 0; 77 static unsigned int allocated_static = 0;
74 static void** array_static = NULL; 78 static void** array_static = NULL;