libavcodec/rawenc.c:62: error: Buffer Overrun L1
  Offset added: 1024 Size: 64 by call to `av_image_copy_to_buffer`.

libavcodec/rawenc.c:51:1: Parameter `frame->data[*]`
49. }
50. 
51. static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
    ^
52.                       const AVFrame *frame, int *got_packet)
53. {

libavcodec/rawenc.c:62:16: Call
60.     if ((ret = ff_alloc_packet(pkt, ret)) < 0)
61.         return ret;
62.     if ((ret = av_image_copy_to_buffer(pkt->data, pkt->size,
                   ^
63.                                        frame->data, frame->linesize,
64.                                        frame->format,

libavutil/imgutils.c:345:1: <Length trace>
343. }
344. 
345. int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
     ^
346.                             const uint8_t * const src_data[4],
347.                             const int src_linesize[4],

libavutil/imgutils.c:345:1: Parameter `**src_data`
  343. }
  344. 
  345. int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
       ^
  346.                             const uint8_t * const src_data[4],
  347.                             const int src_linesize[4],

libavutil/imgutils.c:377:9: Array access: Offset added: 1024 Size: 64 by call to `av_image_copy_to_buffer` 
  375. 
  376.     if (desc->flags & AV_PIX_FMT_FLAG_PAL)
  377.         memcpy((unsigned char *)(((size_t)dst + 3) & ~3),
               ^
  378.                src_data[1], 256 * 4);
  379. 

int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
                            const uint8_t * const src_data[4],
                            const int src_linesize[4],
                            enum AVPixelFormat pix_fmt,
                            int width, int height, int align)
{
    int i, j, nb_planes = 0, linesize[4];
    int size = av_image_get_buffer_size(pix_fmt, width, height, align);
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    if (size > dst_size || size < 0 || !desc)
        return AVERROR(EINVAL);
    for (i = 0; i < desc->nb_components; i++)
        nb_planes = FFMAX(desc->comp[i].plane, nb_planes);
    nb_planes++;
    av_image_fill_linesizes(linesize, pix_fmt, width);
    for (i = 0; i < nb_planes; i++) {
        int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
        const uint8_t *src = src_data[i];
        h = (height + (1 << shift) - 1) >> shift;
        for (j = 0; j < h; j++) {
            memcpy(dst, src, linesize[i]);
            dst += FFALIGN(linesize[i], align);
            src += src_linesize[i];
        }
    }
    if (desc->flags & AV_PIX_FMT_FLAG_PAL)
        memcpy((unsigned char *)(((size_t)dst + 3) & ~3),
               src_data[1], 256 * 4);
    return size;
}
['static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,\n                      const AVFrame *frame, int *got_packet)\n{\n    int ret = av_image_get_buffer_size(avctx->pix_fmt,\n                                       avctx->width, avctx->height, 1);\n    if (ret < 0)\n        return ret;\n    if ((ret = ff_alloc_packet(pkt, ret)) < 0)\n        return ret;\n    if ((ret = av_image_copy_to_buffer(pkt->data, pkt->size,\n                                       frame->data, frame->linesize,\n                                       frame->format,\n                                       frame->width, frame->height, 1)) < 0)\n        return ret;\n    if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 &&\n       avctx->pix_fmt   == AV_PIX_FMT_YUYV422) {\n        int x;\n        for(x = 1; x < avctx->height*avctx->width*2; x += 2)\n            pkt->data[x] ^= 0x80;\n    }\n    pkt->flags |= AV_PKT_FLAG_KEY;\n    *got_packet = 1;\n    return 0;\n}', 'int av_image_copy_to_buffer(uint8_t *dst, int dst_size,\n                            const uint8_t * const src_data[4],\n                            const int src_linesize[4],\n                            enum AVPixelFormat pix_fmt,\n                            int width, int height, int align)\n{\n    int i, j, nb_planes = 0, linesize[4];\n    int size = av_image_get_buffer_size(pix_fmt, width, height, align);\n    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);\n    if (size > dst_size || size < 0 || !desc)\n        return AVERROR(EINVAL);\n    for (i = 0; i < desc->nb_components; i++)\n        nb_planes = FFMAX(desc->comp[i].plane, nb_planes);\n    nb_planes++;\n    av_image_fill_linesizes(linesize, pix_fmt, width);\n    for (i = 0; i < nb_planes; i++) {\n        int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;\n        const uint8_t *src = src_data[i];\n        h = (height + (1 << shift) - 1) >> shift;\n        for (j = 0; j < h; j++) {\n            memcpy(dst, src, linesize[i]);\n            dst += FFALIGN(linesize[i], align);\n            src += src_linesize[i];\n        }\n    }\n    if (desc->flags & AV_PIX_FMT_FLAG_PAL)\n        memcpy((unsigned char *)(((size_t)dst + 3) & ~3),\n               src_data[1], 256 * 4);\n    return size;\n}']