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

libavcodec/dpxenc.c:107:1: Parameter `frame->data[*]`
105. }
106. 
107. static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     ^
108.                         const AVFrame *frame, int *got_packet)
109. {

libavcodec/dpxenc.c:157:16: Call
155.     case 8:
156.     case 16:
157.         size = av_image_copy_to_buffer(buf + HEADER_SIZE,
                    ^
158.                                        pkt->size - HEADER_SIZE,
159.                                        frame->data, frame->linesize,

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 encode_frame(AVCodecContext *avctx, AVPacket *pkt,\n                        const AVFrame *frame, int *got_packet)\n{\n    DPXContext *s = avctx->priv_data;\n    int size, ret;\n    uint8_t *buf;\n#define HEADER_SIZE 1664\n    if (s->bits_per_component == 10)\n        size = avctx->height * avctx->width * 4;\n    else\n        size = av_image_get_buffer_size(avctx->pix_fmt,\n                                        avctx->width, avctx->height, 1);\n    if ((ret = ff_alloc_packet(pkt, size + HEADER_SIZE)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\\n");\n        return ret;\n    }\n    buf = pkt->data;\n    memset(buf, 0, HEADER_SIZE);\n    write32(buf,       MKBETAG(\'S\',\'D\',\'P\',\'X\'));\n    write32(buf +   4, HEADER_SIZE);\n    memcpy (buf +   8, "V1.0", 4);\n    write32(buf +  20, 1);\n    write32(buf +  24, HEADER_SIZE);\n    if (!(avctx->flags & AV_CODEC_FLAG_BITEXACT))\n        memcpy (buf + 160, LIBAVCODEC_IDENT, FFMIN(sizeof(LIBAVCODEC_IDENT), 100));\n    write32(buf + 660, 0xFFFFFFFF);\n    write16(buf + 768, 0);\n    write16(buf + 770, 1);\n    write32(buf + 772, avctx->width);\n    write32(buf + 776, avctx->height);\n    buf[800] = s->descriptor;\n    buf[801] = 2;\n    buf[802] = 2;\n    buf[803] = s->bits_per_component;\n    write16(buf + 804, s->bits_per_component == 10 ? 1 : 0);\n    write32(buf + 808, HEADER_SIZE);\n    write32(buf + 1628, avctx->sample_aspect_ratio.num);\n    write32(buf + 1632, avctx->sample_aspect_ratio.den);\n    switch (s->bits_per_component) {\n    case 8:\n    case 16:\n        size = av_image_copy_to_buffer(buf + HEADER_SIZE,\n                                       pkt->size - HEADER_SIZE,\n                                       frame->data, frame->linesize,\n                                       avctx->pix_fmt,\n                                       avctx->width, avctx->height, 1);\n        if (size < 0)\n            return size;\n        break;\n    case 10:\n        encode_rgb48_10bit(avctx, frame, buf + HEADER_SIZE);\n        break;\n    default:\n        av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\\n", s->bits_per_component);\n        return -1;\n    }\n    size += HEADER_SIZE;\n    write32(buf + 16, size);\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}']