libavcodec/ffv1.c:451: error: Buffer Overrun L3
  Offset: 2 Size: [2, 3] by call to `encode_line`.

libavcodec/ffv1.c:435:26: Assignment
433. static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
434.     int x,y,i;
435.     const int ring_size= s->avctx->context_model ? 3 : 2;
                              ^
436.     int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size];
437.     s->run_index=0;

libavcodec/ffv1.c:435:5: Assignment
433. static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
434.     int x,y,i;
435.     const int ring_size= s->avctx->context_model ? 3 : 2;
         ^
436.     int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size];
437.     s->run_index=0;

libavcodec/ffv1.c:436:57: Array declaration
434.     int x,y,i;
435.     const int ring_size= s->avctx->context_model ? 3 : 2;
436.     int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size];
                                                             ^
437.     s->run_index=0;
438. 

libavcodec/ffv1.c:451:9: Call
449.             sample[0][x]= src[x + stride*y];
450.         }
451.         encode_line(s, w, sample, plane_index, 8);
             ^
452. //STOP_TIMER("encode line")}
453.     }

libavcodec/ffv1.c:355:1: <Length trace>
353. 
354. #if CONFIG_FFV1_ENCODER
355. static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
     ^
356.     PlaneContext * const p= &s->plane[plane_index];
357.     RangeCoder * const c= &s->c;

libavcodec/ffv1.c:355:1: Parameter `*sample`
  353. 
  354. #if CONFIG_FFV1_ENCODER
  355. static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
       ^
  356.     PlaneContext * const p= &s->plane[plane_index];
  357.     RangeCoder * const c= &s->c;

libavcodec/ffv1.c:378:59: Array access: Offset: 2 Size: [2, 3] by call to `encode_line` 
  376.         int diff, context;
  377. 
  378.         context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x);
                                                                 ^
  379.         diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);
  380. 

static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
    PlaneContext * const p= &s->plane[plane_index];
    RangeCoder * const c= &s->c;
    int x;
    int run_index= s->run_index;
    int run_count=0;
    int run_mode=0;
    if(s->ac){
        if(c->bytestream_end - c->bytestream < w*20){
            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
            return -1;
        }
    }else{
        if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < w*4){
            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
            return -1;
        }
    }
    for(x=0; x<w; x++){
        int diff, context;
        context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x);
        diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);
        if(context < 0){
            context = -context;
            diff= -diff;
        }
        diff= fold(diff, bits);
        if(s->ac){
            put_symbol(c, p->state[context], diff, 1);
        }else{
            if(context == 0) run_mode=1;
            if(run_mode){
                if(diff){
                    while(run_count >= 1<<ff_log2_run[run_index]){
                        run_count -= 1<<ff_log2_run[run_index];
                        run_index++;
                        put_bits(&s->pb, 1, 1);
                    }
                    put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count);
                    if(run_index) run_index--;
                    run_count=0;
                    run_mode=0;
                    if(diff>0) diff--;
                }else{
                    run_count++;
                }
            }
            if(run_mode == 0)
                put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
        }
    }
    if(run_mode){
        while(run_count >= 1<<ff_log2_run[run_index]){
            run_count -= 1<<ff_log2_run[run_index];
            run_index++;
            put_bits(&s->pb, 1, 1);
        }
        if(run_count)
            put_bits(&s->pb, 1, 1);
    }
    s->run_index= run_index;
    return 0;
}
['static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){\n    int x,y,i;\n    const int ring_size= s->avctx->context_model ? 3 : 2;\n    int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size];\n    s->run_index=0;\n    memset(sample_buffer, 0, sizeof(sample_buffer));\n    for(y=0; y<h; y++){\n        for(i=0; i<ring_size; i++)\n            sample[i]= sample_buffer[(h+i-y)%ring_size]+3;\n        sample[0][-1]= sample[1][0  ];\n        sample[1][ w]= sample[1][w-1];\n        for(x=0; x<w; x++){\n            sample[0][x]= src[x + stride*y];\n        }\n        encode_line(s, w, sample, plane_index, 8);\n    }\n}', 'static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){\n    PlaneContext * const p= &s->plane[plane_index];\n    RangeCoder * const c= &s->c;\n    int x;\n    int run_index= s->run_index;\n    int run_count=0;\n    int run_mode=0;\n    if(s->ac){\n        if(c->bytestream_end - c->bytestream < w*20){\n            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\\n");\n            return -1;\n        }\n    }else{\n        if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < w*4){\n            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\\n");\n            return -1;\n        }\n    }\n    for(x=0; x<w; x++){\n        int diff, context;\n        context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x);\n        diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);\n        if(context < 0){\n            context = -context;\n            diff= -diff;\n        }\n        diff= fold(diff, bits);\n        if(s->ac){\n            put_symbol(c, p->state[context], diff, 1);\n        }else{\n            if(context == 0) run_mode=1;\n            if(run_mode){\n                if(diff){\n                    while(run_count >= 1<<ff_log2_run[run_index]){\n                        run_count -= 1<<ff_log2_run[run_index];\n                        run_index++;\n                        put_bits(&s->pb, 1, 1);\n                    }\n                    put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count);\n                    if(run_index) run_index--;\n                    run_count=0;\n                    run_mode=0;\n                    if(diff>0) diff--;\n                }else{\n                    run_count++;\n                }\n            }\n            if(run_mode == 0)\n                put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);\n        }\n    }\n    if(run_mode){\n        while(run_count >= 1<<ff_log2_run[run_index]){\n            run_count -= 1<<ff_log2_run[run_index];\n            run_index++;\n            put_bits(&s->pb, 1, 1);\n        }\n        if(run_count)\n            put_bits(&s->pb, 1, 1);\n    }\n    s->run_index= run_index;\n    return 0;\n}']