svq1dec: check that the reference frame matches in size before using it.
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 7 Jan 2013 22:42:35 +0000 (23:42 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 7 Jan 2013 23:28:35 +0000 (00:28 +0100)
Fixes out of array reads

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

index 187522c..5735683 100644 (file)
@@ -692,7 +692,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
         } else {
             /* delta frame */
             uint8_t *previous = s->prev->data[i];
-            if (!previous) {
+            if (!previous || s->prev->width != s->cur->width || s->prev->height != s->cur->height) {
                 av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
                 result = AVERROR_INVALIDDATA;
                 goto err;