libavformat/utils.c:462: error: Null Dereference
  pointer `&tmp->side_data` last assigned on line 461 could be null and is dereferenced by call to `av_packet_ref()` at line 462, column 19.

libavformat/utils.c:416:1: start of procedure ff_read_packet()
414. }
415. 
416. int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
     ^
417. {
418.     int ret, i, err;

libavformat/utils.c:506:5: Loop condition is true. Entering loop body
504.         if ((err = probe_codec(s, st, pkt)) < 0)
505.             return err;
506.     }
         ^
507. }
508. 

libavformat/utils.c:422:9: 
420. 
421.     for (;;) {
422.         AVPacketList *pktl = s->internal->raw_packet_buffer;
             ^
423. 
424.         if (pktl) {

libavformat/utils.c:424:13: Taking false branch
422.         AVPacketList *pktl = s->internal->raw_packet_buffer;
423. 
424.         if (pktl) {
                 ^
425.             *pkt = pktl->pkt;
426.             st   = s->streams[pkt->stream_index];

libavformat/utils.c:444:9: 
442.         }
443. 
444.         pkt->data = NULL;
             ^
445.         pkt->size = 0;
446.         av_init_packet(pkt);

libavformat/utils.c:445:9: 
443. 
444.         pkt->data = NULL;
445.         pkt->size = 0;
             ^
446.         av_init_packet(pkt);
447.         ret = s->iformat->read_packet(s, pkt);

libavformat/utils.c:446:9: 
444.         pkt->data = NULL;
445.         pkt->size = 0;
446.         av_init_packet(pkt);
             ^
447.         ret = s->iformat->read_packet(s, pkt);
448.         if (ret < 0) {

libavcodec/avpacket.c:31:1: start of procedure av_init_packet()
  29. #include "avcodec.h"
  30. 
  31. void av_init_packet(AVPacket *pkt)
      ^
  32. {
  33.     pkt->pts                  = AV_NOPTS_VALUE;

libavcodec/avpacket.c:33:5: 
  31. void av_init_packet(AVPacket *pkt)
  32. {
  33.     pkt->pts                  = AV_NOPTS_VALUE;
          ^
  34.     pkt->dts                  = AV_NOPTS_VALUE;
  35.     pkt->pos                  = -1;

libavcodec/avpacket.c:34:5: 
  32. {
  33.     pkt->pts                  = AV_NOPTS_VALUE;
  34.     pkt->dts                  = AV_NOPTS_VALUE;
          ^
  35.     pkt->pos                  = -1;
  36.     pkt->duration             = 0;

libavcodec/avpacket.c:35:5: 
  33.     pkt->pts                  = AV_NOPTS_VALUE;
  34.     pkt->dts                  = AV_NOPTS_VALUE;
  35.     pkt->pos                  = -1;
          ^
  36.     pkt->duration             = 0;
  37. #if FF_API_CONVERGENCE_DURATION

libavcodec/avpacket.c:36:5: 
  34.     pkt->dts                  = AV_NOPTS_VALUE;
  35.     pkt->pos                  = -1;
  36.     pkt->duration             = 0;
          ^
  37. #if FF_API_CONVERGENCE_DURATION
  38. FF_DISABLE_DEPRECATION_WARNINGS

libavcodec/avpacket.c:39:5: 
  37. #if FF_API_CONVERGENCE_DURATION
  38. FF_DISABLE_DEPRECATION_WARNINGS
  39.     pkt->convergence_duration = 0;
          ^
  40. FF_ENABLE_DEPRECATION_WARNINGS
  41. #endif

libavcodec/avpacket.c:42:5: 
  40. FF_ENABLE_DEPRECATION_WARNINGS
  41. #endif
  42.     pkt->flags                = 0;
          ^
  43.     pkt->stream_index         = 0;
  44.     pkt->buf                  = NULL;

libavcodec/avpacket.c:43:5: 
  41. #endif
  42.     pkt->flags                = 0;
  43.     pkt->stream_index         = 0;
          ^
  44.     pkt->buf                  = NULL;
  45.     pkt->side_data            = NULL;

libavcodec/avpacket.c:44:5: 
  42.     pkt->flags                = 0;
  43.     pkt->stream_index         = 0;
  44.     pkt->buf                  = NULL;
          ^
  45.     pkt->side_data            = NULL;
  46.     pkt->side_data_elems      = 0;

libavcodec/avpacket.c:45:5: 
  43.     pkt->stream_index         = 0;
  44.     pkt->buf                  = NULL;
  45.     pkt->side_data            = NULL;
          ^
  46.     pkt->side_data_elems      = 0;
  47. }

libavcodec/avpacket.c:46:5: 
  44.     pkt->buf                  = NULL;
  45.     pkt->side_data            = NULL;
  46.     pkt->side_data_elems      = 0;
          ^
  47. }
  48. 

libavcodec/avpacket.c:47:1: return from a call to av_init_packet
  45.     pkt->side_data            = NULL;
  46.     pkt->side_data_elems      = 0;
  47. }
      ^
  48. 
  49. AVPacket *av_packet_alloc(void)

libavformat/utils.c:447:9: Skipping __function_pointer__(): unresolved function pointer
445.         pkt->size = 0;
446.         av_init_packet(pkt);
447.         ret = s->iformat->read_packet(s, pkt);
             ^
448.         if (ret < 0) {
449.             if (!pktl || ret == AVERROR(EAGAIN))

libavformat/utils.c:448:13: Taking false branch
446.         av_init_packet(pkt);
447.         ret = s->iformat->read_packet(s, pkt);
448.         if (ret < 0) {
                 ^
449.             if (!pktl || ret == AVERROR(EAGAIN))
450.                 return ret;

libavformat/utils.c:460:14: Taking true branch
458.         }
459. 
460.         if (!pkt->buf) {
                  ^
461.             AVPacket tmp = { 0 };
462.             ret = av_packet_ref(&tmp, pkt);

libavformat/utils.c:461:13: 
459. 
460.         if (!pkt->buf) {
461.             AVPacket tmp = { 0 };
                 ^
462.             ret = av_packet_ref(&tmp, pkt);
463.             if (ret < 0)

libavformat/utils.c:462:13: 
460.         if (!pkt->buf) {
461.             AVPacket tmp = { 0 };
462.             ret = av_packet_ref(&tmp, pkt);
                 ^
463.             if (ret < 0)
464.                 return ret;

libavcodec/avpacket.c:356:1: start of procedure av_packet_ref()
  354. }
  355. 
  356. int av_packet_ref(AVPacket *dst, const AVPacket *src)
       ^
  357. {
  358.     int ret;

libavcodec/avpacket.c:360:5: 
  358.     int ret;
  359. 
  360.     ret = av_packet_copy_props(dst, src);
           ^
  361.     if (ret < 0)
  362.         return ret;

libavcodec/avpacket.c:315:1: start of procedure av_packet_copy_props()
    313. }
    314. 
    315. int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
         ^
    316. {
    317.     int i;

libavcodec/avpacket.c:319:5: 
    317.     int i;
    318. 
    319.     dst->pts                  = src->pts;
             ^
    320.     dst->dts                  = src->dts;
    321.     dst->pos                  = src->pos;

libavcodec/avpacket.c:320:5: 
    318. 
    319.     dst->pts                  = src->pts;
    320.     dst->dts                  = src->dts;
             ^
    321.     dst->pos                  = src->pos;
    322.     dst->duration             = src->duration;

libavcodec/avpacket.c:321:5: 
    319.     dst->pts                  = src->pts;
    320.     dst->dts                  = src->dts;
    321.     dst->pos                  = src->pos;
             ^
    322.     dst->duration             = src->duration;
    323. #if FF_API_CONVERGENCE_DURATION

libavcodec/avpacket.c:322:5: 
    320.     dst->dts                  = src->dts;
    321.     dst->pos                  = src->pos;
    322.     dst->duration             = src->duration;
             ^
    323. #if FF_API_CONVERGENCE_DURATION
    324. FF_DISABLE_DEPRECATION_WARNINGS

libavcodec/avpacket.c:325:5: 
    323. #if FF_API_CONVERGENCE_DURATION
    324. FF_DISABLE_DEPRECATION_WARNINGS
    325.     dst->convergence_duration = src->convergence_duration;
             ^
    326. FF_ENABLE_DEPRECATION_WARNINGS
    327. #endif

libavcodec/avpacket.c:328:5: 
    326. FF_ENABLE_DEPRECATION_WARNINGS
    327. #endif
    328.     dst->flags                = src->flags;
             ^
    329.     dst->stream_index         = src->stream_index;
    330. 

libavcodec/avpacket.c:329:5: 
    327. #endif
    328.     dst->flags                = src->flags;
    329.     dst->stream_index         = src->stream_index;
             ^
    330. 
    331.     for (i = 0; i < src->side_data_elems; i++) {

libavcodec/avpacket.c:331:10: 
    329.     dst->stream_index         = src->stream_index;
    330. 
    331.     for (i = 0; i < src->side_data_elems; i++) {
                  ^
    332.          enum AVPacketSideDataType type = src->side_data[i].type;
    333.          int size          = src->side_data[i].size;

libavcodec/avpacket.c:331:17: Loop condition is true. Entering loop body
    329.     dst->stream_index         = src->stream_index;
    330. 
    331.     for (i = 0; i < src->side_data_elems; i++) {
                         ^
    332.          enum AVPacketSideDataType type = src->side_data[i].type;
    333.          int size          = src->side_data[i].size;

libavcodec/avpacket.c:332:10: 
    330. 
    331.     for (i = 0; i < src->side_data_elems; i++) {
    332.          enum AVPacketSideDataType type = src->side_data[i].type;
                  ^
    333.          int size          = src->side_data[i].size;
    334.          uint8_t *src_data = src->side_data[i].data;

libavcodec/avpacket.c:333:10: 
    331.     for (i = 0; i < src->side_data_elems; i++) {
    332.          enum AVPacketSideDataType type = src->side_data[i].type;
    333.          int size          = src->side_data[i].size;
                  ^
    334.          uint8_t *src_data = src->side_data[i].data;
    335.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);

libavcodec/avpacket.c:334:10: 
    332.          enum AVPacketSideDataType type = src->side_data[i].type;
    333.          int size          = src->side_data[i].size;
    334.          uint8_t *src_data = src->side_data[i].data;
                  ^
    335.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
    336. 

libavcodec/avpacket.c:335:10: 
    333.          int size          = src->side_data[i].size;
    334.          uint8_t *src_data = src->side_data[i].data;
    335.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
                  ^
    336. 
    337.         if (!dst_data) {

libavcodec/avpacket.c:263:1: start of procedure av_packet_new_side_data()
      261. 
      262. 
      263. uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
           ^
      264.                                  int size)
      265. {

libavcodec/avpacket.c:269:10: Taking false branch
      267.     uint8_t *data;
      268. 
      269.     if (!size || (unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
                    ^
      270.         return NULL;
      271.     data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:269:18: Taking false branch
      267.     uint8_t *data;
      268. 
      269.     if (!size || (unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
                            ^
      270.         return NULL;
      271.     data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);

libavcodec/avpacket.c:271:5: 
      269.     if (!size || (unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
      270.         return NULL;
      271.     data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
               ^
      272.     if (!data)
      273.         return NULL;

libavutil/mem.c:62:1: start of procedure av_malloc()
        60.  * linker will do it automatically. */
        61. 
        62. void *av_malloc(size_t size)
            ^
        63. {
        64.     void *ptr = NULL;

libavutil/mem.c:64:5: 
        62. void *av_malloc(size_t size)
        63. {
        64.     void *ptr = NULL;
                ^
        65. 
        66.     /* let's disallow possibly ambiguous cases */

libavutil/mem.c:67:9: Taking true branch
        65. 
        66.     /* let's disallow possibly ambiguous cases */
        67.     if (size > (INT_MAX - 32) || !size)
                    ^
        68.         return NULL;
        69. 

libavutil/mem.c:68:9: 
        66.     /* let's disallow possibly ambiguous cases */
        67.     if (size > (INT_MAX - 32) || !size)
        68.         return NULL;
                    ^
        69. 
        70. #if HAVE_POSIX_MEMALIGN

libavutil/mem.c:105:1: return from a call to av_malloc
        103. #endif
        104.     return ptr;
        105. }
             ^
        106. 
        107. void *av_realloc(void *ptr, size_t size)

libavcodec/avpacket.c:272:10: Taking true branch
      270.         return NULL;
      271.     data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
      272.     if (!data)
                    ^
      273.         return NULL;
      274. 

libavcodec/avpacket.c:273:9: 
      271.     data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
      272.     if (!data)
      273.         return NULL;
                   ^
      274. 
      275.     ret = av_packet_add_side_data(pkt, type, data, size);

libavcodec/avpacket.c:282:1: return from a call to av_packet_new_side_data
      280. 
      281.     return data;
      282. }
           ^
      283. 
      284. uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,

libavcodec/avpacket.c:337:14: Taking true branch
    335.          uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
    336. 
    337.         if (!dst_data) {
                      ^
    338.             av_packet_free_side_data(dst);
    339.             return AVERROR(ENOMEM);

libavcodec/avpacket.c:338:13: 
    336. 
    337.         if (!dst_data) {
    338.             av_packet_free_side_data(dst);
                     ^
    339.             return AVERROR(ENOMEM);
    340.         }

libavcodec/avpacket.c:215:1: start of procedure av_packet_free_side_data()
      213. #endif
      214. 
      215. void av_packet_free_side_data(AVPacket *pkt)
           ^
      216. {
      217.     int i;

libavcodec/avpacket.c:218:10: 
      216. {
      217.     int i;
      218.     for (i = 0; i < pkt->side_data_elems; i++)
                    ^
      219.         av_free(pkt->side_data[i].data);
      220.     av_freep(&pkt->side_data);

libavcodec/avpacket.c:218:17: Loop condition is false. Leaving loop
      216. {
      217.     int i;
      218.     for (i = 0; i < pkt->side_data_elems; i++)
                           ^
      219.         av_free(pkt->side_data[i].data);
      220.     av_freep(&pkt->side_data);

libavcodec/avpacket.c:220:5: Skipping av_freep(): empty list of specs
      218.     for (i = 0; i < pkt->side_data_elems; i++)
      219.         av_free(pkt->side_data[i].data);
      220.     av_freep(&pkt->side_data);
               ^
      221.     pkt->side_data_elems = 0;
      222. }

libavcodec/avpacket.c:221:5: 
      219.         av_free(pkt->side_data[i].data);
      220.     av_freep(&pkt->side_data);
      221.     pkt->side_data_elems = 0;
               ^
      222. }
      223. 

libavcodec/avpacket.c:222:1: return from a call to av_packet_free_side_data
      220.     av_freep(&pkt->side_data);
      221.     pkt->side_data_elems = 0;
      222. }
           ^
      223. 
      224. #if FF_API_AVPACKET_OLD_API

libavcodec/avpacket.c:339:13: 
    337.         if (!dst_data) {
    338.             av_packet_free_side_data(dst);
    339.             return AVERROR(ENOMEM);
                     ^
    340.         }
    341.         memcpy(dst_data, src_data, size);

libavcodec/avpacket.c:345:1: return from a call to av_packet_copy_props
    343. 
    344.     return 0;
    345. }
         ^
    346. 
    347. void av_packet_unref(AVPacket *pkt)

libavcodec/avpacket.c:361:9: Taking true branch
  359. 
  360.     ret = av_packet_copy_props(dst, src);
  361.     if (ret < 0)
               ^
  362.         return ret;
  363. 

libavcodec/avpacket.c:362:9: 
  360.     ret = av_packet_copy_props(dst, src);
  361.     if (ret < 0)
  362.         return ret;
               ^
  363. 
  364.     if (!src->buf) {

libavcodec/avpacket.c:386:1: return from a call to av_packet_ref
  384.     av_packet_free_side_data(dst);
  385.     return ret;
  386. }
       ^
  387. 
  388. AVPacket *av_packet_clone(const AVPacket *src)

int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    int ret, i, err;
    AVStream *st;
    for (;;) {
        AVPacketList *pktl = s->internal->raw_packet_buffer;
        if (pktl) {
            *pkt = pktl->pkt;
            st   = s->streams[pkt->stream_index];
            if (st->codecpar->codec_id != AV_CODEC_ID_PROBE ||
                !st->probe_packets ||
                s->internal->raw_packet_buffer_remaining_size < pkt->size) {
                AVProbeData *pd;
                if (st->probe_packets)
                    if ((err = probe_codec(s, st, NULL)) < 0)
                        return err;
                pd = &st->probe_data;
                av_freep(&pd->buf);
                pd->buf_size = 0;
                s->internal->raw_packet_buffer                 = pktl->next;
                s->internal->raw_packet_buffer_remaining_size += pkt->size;
                av_free(pktl);
                return 0;
            }
        }
        pkt->data = NULL;
        pkt->size = 0;
        av_init_packet(pkt);
        ret = s->iformat->read_packet(s, pkt);
        if (ret < 0) {
            if (!pktl || ret == AVERROR(EAGAIN))
                return ret;
            for (i = 0; i < s->nb_streams; i++) {
                st = s->streams[i];
                if (st->probe_packets)
                    if ((err = probe_codec(s, st, NULL)) < 0)
                        return err;
            }
            continue;
        }
        if (!pkt->buf) {
            AVPacket tmp = { 0 };
            ret = av_packet_ref(&tmp, pkt);
            if (ret < 0)
                return ret;
            *pkt = tmp;
        }
        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
            av_log(s, AV_LOG_WARNING,
                   "Dropped corrupted packet (stream = %d)\n",
                   pkt->stream_index);
            av_packet_unref(pkt);
            continue;
        }
        st = s->streams[pkt->stream_index];
        switch (st->codecpar->codec_type) {
        case AVMEDIA_TYPE_VIDEO:
            if (s->video_codec_id)
                st->codecpar->codec_id = s->video_codec_id;
            break;
        case AVMEDIA_TYPE_AUDIO:
            if (s->audio_codec_id)
                st->codecpar->codec_id = s->audio_codec_id;
            break;
        case AVMEDIA_TYPE_SUBTITLE:
            if (s->subtitle_codec_id)
                st->codecpar->codec_id = s->subtitle_codec_id;
            break;
        }
        if (!pktl && (st->codecpar->codec_id != AV_CODEC_ID_PROBE ||
                      !st->probe_packets))
            return ret;
        err = add_to_pktbuf(&s->internal->raw_packet_buffer, pkt,
                            &s->internal->raw_packet_buffer_end, 0);
        if (err)
            return err;
        s->internal->raw_packet_buffer_remaining_size -= pkt->size;
        if ((err = probe_codec(s, st, pkt)) < 0)
            return err;
    }
}
['int ff_read_packet(AVFormatContext *s, AVPacket *pkt)\n{\n    int ret, i, err;\n    AVStream *st;\n    for (;;) {\n        AVPacketList *pktl = s->internal->raw_packet_buffer;\n        if (pktl) {\n            *pkt = pktl->pkt;\n            st   = s->streams[pkt->stream_index];\n            if (st->codecpar->codec_id != AV_CODEC_ID_PROBE ||\n                !st->probe_packets ||\n                s->internal->raw_packet_buffer_remaining_size < pkt->size) {\n                AVProbeData *pd;\n                if (st->probe_packets)\n                    if ((err = probe_codec(s, st, NULL)) < 0)\n                        return err;\n                pd = &st->probe_data;\n                av_freep(&pd->buf);\n                pd->buf_size = 0;\n                s->internal->raw_packet_buffer                 = pktl->next;\n                s->internal->raw_packet_buffer_remaining_size += pkt->size;\n                av_free(pktl);\n                return 0;\n            }\n        }\n        pkt->data = NULL;\n        pkt->size = 0;\n        av_init_packet(pkt);\n        ret = s->iformat->read_packet(s, pkt);\n        if (ret < 0) {\n            if (!pktl || ret == AVERROR(EAGAIN))\n                return ret;\n            for (i = 0; i < s->nb_streams; i++) {\n                st = s->streams[i];\n                if (st->probe_packets)\n                    if ((err = probe_codec(s, st, NULL)) < 0)\n                        return err;\n            }\n            continue;\n        }\n        if (!pkt->buf) {\n            AVPacket tmp = { 0 };\n            ret = av_packet_ref(&tmp, pkt);\n            if (ret < 0)\n                return ret;\n            *pkt = tmp;\n        }\n        if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&\n            (pkt->flags & AV_PKT_FLAG_CORRUPT)) {\n            av_log(s, AV_LOG_WARNING,\n                   "Dropped corrupted packet (stream = %d)\\n",\n                   pkt->stream_index);\n            av_packet_unref(pkt);\n            continue;\n        }\n        st = s->streams[pkt->stream_index];\n        switch (st->codecpar->codec_type) {\n        case AVMEDIA_TYPE_VIDEO:\n            if (s->video_codec_id)\n                st->codecpar->codec_id = s->video_codec_id;\n            break;\n        case AVMEDIA_TYPE_AUDIO:\n            if (s->audio_codec_id)\n                st->codecpar->codec_id = s->audio_codec_id;\n            break;\n        case AVMEDIA_TYPE_SUBTITLE:\n            if (s->subtitle_codec_id)\n                st->codecpar->codec_id = s->subtitle_codec_id;\n            break;\n        }\n        if (!pktl && (st->codecpar->codec_id != AV_CODEC_ID_PROBE ||\n                      !st->probe_packets))\n            return ret;\n        err = add_to_pktbuf(&s->internal->raw_packet_buffer, pkt,\n                            &s->internal->raw_packet_buffer_end, 0);\n        if (err)\n            return err;\n        s->internal->raw_packet_buffer_remaining_size -= pkt->size;\n        if ((err = probe_codec(s, st, pkt)) < 0)\n            return err;\n    }\n}', 'void av_init_packet(AVPacket *pkt)\n{\n    pkt->pts                  = AV_NOPTS_VALUE;\n    pkt->dts                  = AV_NOPTS_VALUE;\n    pkt->pos                  = -1;\n    pkt->duration             = 0;\n#if FF_API_CONVERGENCE_DURATION\nFF_DISABLE_DEPRECATION_WARNINGS\n    pkt->convergence_duration = 0;\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n    pkt->flags                = 0;\n    pkt->stream_index         = 0;\n    pkt->buf                  = NULL;\n    pkt->side_data            = NULL;\n    pkt->side_data_elems      = 0;\n}', 'int av_packet_ref(AVPacket *dst, const AVPacket *src)\n{\n    int ret;\n    ret = av_packet_copy_props(dst, src);\n    if (ret < 0)\n        return ret;\n    if (!src->buf) {\n        ret = packet_alloc(&dst->buf, src->size);\n        if (ret < 0)\n            goto fail;\n        memcpy(dst->buf->data, src->data, src->size);\n        dst->data = dst->buf->data;\n    } else {\n        dst->buf = av_buffer_ref(src->buf);\n        if (!dst->buf) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        dst->data = src->data;\n    }\n    dst->size = src->size;\n    return 0;\nfail:\n    av_packet_free_side_data(dst);\n    return ret;\n}', 'int av_packet_copy_props(AVPacket *dst, const AVPacket *src)\n{\n    int i;\n    dst->pts                  = src->pts;\n    dst->dts                  = src->dts;\n    dst->pos                  = src->pos;\n    dst->duration             = src->duration;\n#if FF_API_CONVERGENCE_DURATION\nFF_DISABLE_DEPRECATION_WARNINGS\n    dst->convergence_duration = src->convergence_duration;\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n    dst->flags                = src->flags;\n    dst->stream_index         = src->stream_index;\n    for (i = 0; i < src->side_data_elems; i++) {\n         enum AVPacketSideDataType type = src->side_data[i].type;\n         int size          = src->side_data[i].size;\n         uint8_t *src_data = src->side_data[i].data;\n         uint8_t *dst_data = av_packet_new_side_data(dst, type, size);\n        if (!dst_data) {\n            av_packet_free_side_data(dst);\n            return AVERROR(ENOMEM);\n        }\n        memcpy(dst_data, src_data, size);\n    }\n    return 0;\n}', 'uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,\n                                 int size)\n{\n    int ret;\n    uint8_t *data;\n    if (!size || (unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)\n        return NULL;\n    data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);\n    if (!data)\n        return NULL;\n    ret = av_packet_add_side_data(pkt, type, data, size);\n    if (ret < 0) {\n        av_freep(&data);\n        return NULL;\n    }\n    return data;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n    if (size > (INT_MAX - 32) || !size)\n        return NULL;\n#if HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr, 32, size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32, size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'void av_packet_free_side_data(AVPacket *pkt)\n{\n    int i;\n    for (i = 0; i < pkt->side_data_elems; i++)\n        av_free(pkt->side_data[i].data);\n    av_freep(&pkt->side_data);\n    pkt->side_data_elems = 0;\n}']