sws_allocVec: check length validity

Found-by: Reimar
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-27 01:18:52 +02:00
parent a9d97e1b0a
commit fe573d1a9b

View File

@ -1415,7 +1415,12 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
SwsVector *sws_allocVec(int length)
{
SwsVector *vec = av_malloc(sizeof(SwsVector));
SwsVector *vec;
if(length <= 0 || length > INT_MAX/ sizeof(double))
return NULL;
vec = av_malloc(sizeof(SwsVector));
if (!vec)
return NULL;
vec->length = length;