[FFmpeg-cvslog] sws_allocVec: check length validity

Michael Niedermayer git at videolan.org
Sat Oct 27 01:34:06 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Oct 27 01:18:52 2012 +0200| [fe573d1a9b742652f44cdc15b24fdd401eefc5e7] | committer: Michael Niedermayer

sws_allocVec: check length validity

Found-by: Reimar
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe573d1a9b742652f44cdc15b24fdd401eefc5e7
---

 libswscale/utils.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 24058c3..03e9463 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -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;



More information about the ffmpeg-cvslog mailing list