]> git.sesse.net Git - ffmpeg/commitdiff
mmvideo: check horizontal coordinate too
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 3 Aug 2014 18:24:18 +0000 (19:24 +0100)
committerAnton Khirnov <anton@khirnov.net>
Tue, 5 Aug 2014 19:16:12 +0000 (19:16 +0000)
Fixes out of array accesses.

Bug-Id: CVE-2013-3672
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/mmvideo.c

index abec2e8150b397b1947380fa4cbca43d5da01e5a..d80c832a3187ed69725e512735bb55f1ebe63255 100644 (file)
@@ -154,6 +154,8 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
             int replace_array = bytestream2_get_byte(&s->gb);
             for(j=0; j<8; j++) {
                 int replace = (replace_array >> (7-j)) & 1;
+                if (x + half_horiz >= s->avctx->width)
+                    return AVERROR_INVALIDDATA;
                 if (replace) {
                     int color = bytestream2_get_byte(&data_ptr);
                     s->frame->data[0][y*s->frame->linesize[0] + x] = color;