rv34: check image size before using it
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Nov 2012 02:46:35 +0000 (03:46 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 16 Nov 2012 04:16:34 +0000 (05:16 +0100)
fixes assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/rv34.c

index 4226ecb..6527252 100644 (file)
@@ -24,6 +24,7 @@
  * RV30/40 decoder common data
  */
 
+#include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 
 #include "avcodec.h"
@@ -1661,6 +1662,9 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
             av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n",
                    si.width, si.height);
 
+            if (av_image_check_size(si.width, si.height, 0, s->avctx))
+                return AVERROR_INVALIDDATA;
+
             s->width  = si.width;
             s->height = si.height;
             avcodec_set_dimensions(s->avctx, s->width, s->height);