ffv1: fix out-of-bounds read
authorVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 11 Nov 2014 16:40:04 +0000 (17:40 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 12 Jan 2015 23:16:41 +0000 (00:16 +0100)
CC: libav-stable@libav.org
Bug-Id: CID 1047234
(cherry picked from commit 6abe7edabb7d57e82d7ea6312d30cf05d2192c5b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/ffv1enc.c

index 179453d..93630b4 100644 (file)
@@ -71,7 +71,7 @@ static void find_best_state(uint8_t best_state[256][256],
                     best_len[k]      = len;
                     best_state[i][k] = j;
                 }
-                for (m = 0; m < 256; m++)
+                for (m = 1; m < 256; m++)
                     if (occ[m]) {
                         newocc[one_state[m]]             += occ[m] * p;
                         newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);