libavcodec/ffv1.c:267: error: Buffer Overrun L2
  Offset: [1, 256] Size: 256.

libavcodec/ffv1.c:264:22: <Offset trace>
262.             for (k = 0; k < 256; k++) {
263.                 double newocc[256] = { 0 };
264.                 for (m = 0; m < 256; m++)
                          ^
265.                     if (occ[m]) {
266.                         len -= occ[m] *     (p  * l2tab[m] +

libavcodec/ffv1.c:264:22: Assignment
262.             for (k = 0; k < 256; k++) {
263.                 double newocc[256] = { 0 };
264.                 for (m = 0; m < 256; m++)
                          ^
265.                     if (occ[m]) {
266.                         len -= occ[m] *     (p  * l2tab[m] +

libavcodec/ffv1.c:242:1: <Length trace>
240. }
241. 
242. static void find_best_state(uint8_t best_state[256][256],
     ^
243.                             const uint8_t one_state[256])
244. {

libavcodec/ffv1.c:242:1: Array declaration
240. }
241. 
242. static void find_best_state(uint8_t best_state[256][256],
     ^
243.                             const uint8_t one_state[256])
244. {

libavcodec/ffv1.c:267:51: Array access: Offset: [1, 256] Size: 256
265.                     if (occ[m]) {
266.                         len -= occ[m] *     (p  * l2tab[m] +
267.                                         (1 - p) * l2tab[256 - m]);
                                                       ^
268.                     }
269.                 if (len < best_len[k]) {

static void find_best_state(uint8_t best_state[256][256],
                            const uint8_t one_state[256])
{
    int i, j, k, m;
    double l2tab[256];
    for (i = 1; i < 256; i++)
        l2tab[i] = log2(i / 256.0);
    for (i = 0; i < 256; i++) {
        double best_len[256];
        double p = i / 256.0;
        for (j = 0; j < 256; j++)
            best_len[j] = 1 << 30;
        for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) {
            double occ[256] = { 0 };
            double len      = 0;
            occ[j] = 1.0;
            for (k = 0; k < 256; k++) {
                double newocc[256] = { 0 };
                for (m = 0; m < 256; m++)
                    if (occ[m]) {
                        len -= occ[m] *     (p  * l2tab[m] +
                                        (1 - p) * l2tab[256 - m]);
                    }
                if (len < best_len[k]) {
                    best_len[k]      = len;
                    best_state[i][k] = j;
                }
                for (m = 0; m < 256; m++)
                    if (occ[m]) {
                        newocc[one_state[m]]             += occ[m] * p;
                        newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);
                    }
                memcpy(occ, newocc, sizeof(occ));
            }
        }
    }
}
['static void find_best_state(uint8_t best_state[256][256],\n                            const uint8_t one_state[256])\n{\n    int i, j, k, m;\n    double l2tab[256];\n    for (i = 1; i < 256; i++)\n        l2tab[i] = log2(i / 256.0);\n    for (i = 0; i < 256; i++) {\n        double best_len[256];\n        double p = i / 256.0;\n        for (j = 0; j < 256; j++)\n            best_len[j] = 1 << 30;\n        for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) {\n            double occ[256] = { 0 };\n            double len      = 0;\n            occ[j] = 1.0;\n            for (k = 0; k < 256; k++) {\n                double newocc[256] = { 0 };\n                for (m = 0; m < 256; m++)\n                    if (occ[m]) {\n                        len -= occ[m] *     (p  * l2tab[m] +\n                                        (1 - p) * l2tab[256 - m]);\n                    }\n                if (len < best_len[k]) {\n                    best_len[k]      = len;\n                    best_state[i][k] = j;\n                }\n                for (m = 0; m < 256; m++)\n                    if (occ[m]) {\n                        newocc[one_state[m]]             += occ[m] * p;\n                        newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);\n                    }\n                memcpy(occ, newocc, sizeof(occ));\n            }\n        }\n    }\n}']