indeo3: fix out of cell write.
authorAnton Khirnov <anton@khirnov.net>
Sat, 29 Sep 2012 08:39:49 +0000 (10:39 +0200)
committerReinhard Tartler <siretart@tauware.de>
Sun, 14 Oct 2012 20:03:24 +0000 (16:03 -0400)
Fixes CVE-2012-2776.

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit e4d4044339b9c3b0f45f7203cd026eda3c0414c0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/indeo3.c

index b7ef9e52415b26149d8fde06bd2a85b418b67ae2..294527ec9d3345a747938ce2e3db8c527c784d0e 100644 (file)
@@ -416,6 +416,9 @@ static int decode_cell_data(Cell *cell, uint8_t *block, uint8_t *ref_block,
     blk_row_offset = (row_offset << (2 + v_zoom)) - (cell->width << 2);
     line_offset    = v_zoom ? row_offset : 0;
 
+    if (cell->height & v_zoom || cell->width & h_zoom)
+        return IV3_BAD_DATA;
+
     for (y = 0; y < cell->height; is_first_row = 0, y += 1 + v_zoom) {
         for (x = 0; x < cell->width; x += 1 + h_zoom) {
             ref = ref_block;