libavcodec/ffv1.c:915: error: Buffer Overrun L3
  Offset: [-1, +oo] (⇐ [0, +oo] + -1) Size: 3 by call to `encode_rgb_frame`.

libavcodec/ffv1.c:898:5: Assignment
896.     FFV1Context *fs= *(void**)arg;
897.     FFV1Context *f= fs->avctx->priv_data;
898.     int width = fs->slice_width;
         ^
899.     int height= fs->slice_height;
900.     int x= fs->slice_x;

libavcodec/ffv1.c:915:9: Call
913.         encode_plane(fs, p->data[2] + cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1);
914.     }else{
915.         encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4);
             ^
916.     }
917.     emms_c();

libavcodec/ffv1.c:559:1: Array declaration
  557. }
  558. 
  559. static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
       ^
  560.     int x, y, p, i;
  561.     const int ring_size= s->avctx->context_model ? 3 : 2;

libavcodec/ffv1.c:593:13: Call
  591.             sample[p][0][-1]= sample[p][1][0  ];
  592.             sample[p][1][ w]= sample[p][1][w-1];
  593.             encode_line(s, w, sample[p], FFMIN(p, 1), 9);
                   ^
  594.         }
  595.     }

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

libavcodec/ffv1.c:474:18: Call
    472.         int diff, context;
    473. 
    474.         context= get_context(p, sample[0]+x, sample[1]+x, sample[2]+x);
                          ^
    475.         diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);
    476. 

libavcodec/ffv1.c:284:1: <Length trace>
282. }
283. 
284. static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
     ^
285.     const int LT= last[-1];
286.     const int  T= last[ 0];

libavcodec/ffv1.c:284:1: Parameter `*last`
      282. }
      283. 
      284. static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
           ^
      285.     const int LT= last[-1];
      286.     const int  T= last[ 0];

libavcodec/ffv1.c:285:19: Array access: Offset: [-1, +oo] (⇐ [0, +oo] + -1) Size: 3 by call to `encode_rgb_frame` 
      283. 
      284. static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
      285.     const int LT= last[-1];
                             ^
      286.     const int  T= last[ 0];
      287.     const int RT= last[ 1];

static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
    const int LT= last[-1];
    const int  T= last[ 0];
    const int RT= last[ 1];
    const int L =  src[-1];
    if(p->quant_table[3][127]){
        const int TT= last2[0];
        const int LL=  src[-2];
        return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF]
              +p->quant_table[3][(LL-L) & 0xFF] + p->quant_table[4][(TT-T) & 0xFF];
    }else
        return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF];
}
['static int encode_slice(AVCodecContext *c, void *arg){\n    FFV1Context *fs= *(void**)arg;\n    FFV1Context *f= fs->avctx->priv_data;\n    int width = fs->slice_width;\n    int height= fs->slice_height;\n    int x= fs->slice_x;\n    int y= fs->slice_y;\n    AVFrame * const p= &f->picture;\n    if(f->colorspace==0){\n        const int chroma_width = -((-width )>>f->chroma_h_shift);\n        const int chroma_height= -((-height)>>f->chroma_v_shift);\n        const int cx= x>>f->chroma_h_shift;\n        const int cy= y>>f->chroma_v_shift;\n        encode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0);\n        encode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1);\n        encode_plane(fs, p->data[2] + cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1);\n    }else{\n        encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4);\n    }\n    emms_c();\n    return 0;\n}', 'static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){\n    int x, y, p, i;\n    const int ring_size= s->avctx->context_model ? 3 : 2;\n    int_fast16_t *sample[3][3];\n    s->run_index=0;\n    memset(s->sample_buffer, 0, ring_size*3*(w+6)*sizeof(*s->sample_buffer));\n    for(y=0; y<h; y++){\n        for(i=0; i<ring_size; i++)\n            for(p=0; p<3; p++)\n                sample[p][i]= s->sample_buffer + p*ring_size*(w+6) + ((h+i-y)%ring_size)*(w+6) + 3;\n        for(x=0; x<w; x++){\n            int v= src[x + stride*y];\n            int b= v&0xFF;\n            int g= (v>>8)&0xFF;\n            int r= (v>>16)&0xFF;\n            b -= g;\n            r -= g;\n            g += (b + r)>>2;\n            b += 0x100;\n            r += 0x100;\n            sample[0][0][x]= g;\n            sample[1][0][x]= b;\n            sample[2][0][x]= r;\n        }\n        for(p=0; p<3; p++){\n            sample[p][0][-1]= sample[p][1][0  ];\n            sample[p][1][ w]= sample[p][1][w-1];\n            encode_line(s, w, sample[p], FFMIN(p, 1), 9);\n        }\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(p, 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_inline(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}', 'static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){\n    const int LT= last[-1];\n    const int  T= last[ 0];\n    const int RT= last[ 1];\n    const int L =  src[-1];\n    if(p->quant_table[3][127]){\n        const int TT= last2[0];\n        const int LL=  src[-2];\n        return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF]\n              +p->quant_table[3][(LL-L) & 0xFF] + p->quant_table[4][(TT-T) & 0xFF];\n    }else\n        return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF];\n}']