libavformat/utils.c:2660: error: Integer Overflow L2
  ([1, 32] - [0, 31]):unsigned64 by call to `av_get_codec_tag_string`.

libavformat/utils.c:2660:21: Call
2658.                 if (!validate_codec_tag(s, st)) {
2659.                     char tagbuf[32];
2660.                     av_get_codec_tag_string(tagbuf, sizeof(tagbuf), st->codec->codec_tag);
                          ^
2661.                     av_log(s, AV_LOG_ERROR,
2662.                            "Tag %s/0x%08x incompatible with output codec '%s'\n",

libavcodec/utils.c:805:1: <LHS trace>
803. }
804. 
805. size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
     ^
806. {
807.     int i, len, ret = 0;

libavcodec/utils.c:805:1: Parameter `buf_size`
  803. }
  804. 
  805. size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
       ^
  806. {
  807.     int i, len, ret = 0;

libavcodec/utils.c:805:1: <RHS trace>
803. }
804. 
805. size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
     ^
806. {
807.     int i, len, ret = 0;

libavcodec/utils.c:805:1: Parameter `buf_size`
  803. }
  804. 
  805. size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
       ^
  806. {
  807.     int i, len, ret = 0;

libavcodec/utils.c:813:21: Binary operation: ([1, 32] - [0, 31]):unsigned64 by call to `av_get_codec_tag_string` 
  811.                        isprint(codec_tag&0xFF) ? "%c" : "[%d]", codec_tag&0xFF);
  812.         buf      += len;
  813.         buf_size  = buf_size > len ? buf_size - len : 0;
                           ^
  814.         ret      += len;
  815.         codec_tag>>=8;

size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
{
    int i, len, ret = 0;
    for (i = 0; i < 4; i++) {
        len = snprintf(buf, buf_size,
                       isprint(codec_tag&0xFF) ? "%c" : "[%d]", codec_tag&0xFF);
        buf      += len;
        buf_size  = buf_size > len ? buf_size - len : 0;
        ret      += len;
        codec_tag>>=8;
    }
    return ret;
}
['int av_write_header(AVFormatContext *s)\n{\n    int ret, i;\n    AVStream *st;\n    if (s->nb_streams == 0) {\n        av_log(s, AV_LOG_ERROR, "no streams\\n");\n        return AVERROR(EINVAL);\n    }\n    for(i=0;i<s->nb_streams;i++) {\n        st = s->streams[i];\n        switch (st->codec->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            if(st->codec->sample_rate<=0){\n                av_log(s, AV_LOG_ERROR, "sample rate not set\\n");\n                return AVERROR(EINVAL);\n            }\n            if(!st->codec->block_align)\n                st->codec->block_align = st->codec->channels *\n                    av_get_bits_per_sample(st->codec->codec_id) >> 3;\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){\n                av_log(s, AV_LOG_ERROR, "time base not set\\n");\n                return AVERROR(EINVAL);\n            }\n            if((st->codec->width<=0 || st->codec->height<=0) && !(s->oformat->flags & AVFMT_NODIMENSIONS)){\n                av_log(s, AV_LOG_ERROR, "dimensions not set\\n");\n                return AVERROR(EINVAL);\n            }\n            if(av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)){\n                av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between encoder and muxer layer\\n");\n                return AVERROR(EINVAL);\n            }\n            break;\n        }\n        if(s->oformat->codec_tag){\n            if(st->codec->codec_tag){\n                if (!validate_codec_tag(s, st)) {\n                    char tagbuf[32];\n                    av_get_codec_tag_string(tagbuf, sizeof(tagbuf), st->codec->codec_tag);\n                    av_log(s, AV_LOG_ERROR,\n                           "Tag %s/0x%08x incompatible with output codec \'%s\'\\n",\n                           tagbuf, st->codec->codec_tag, st->codec->codec->name);\n                    return AVERROR_INVALIDDATA;\n                }\n            }else\n                st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id);\n        }\n        if(s->oformat->flags & AVFMT_GLOBALHEADER &&\n            !(st->codec->flags & CODEC_FLAG_GLOBAL_HEADER))\n          av_log(s, AV_LOG_WARNING, "Codec for stream %d does not use global headers but container format requires global headers\\n", i);\n    }\n    if (!s->priv_data && s->oformat->priv_data_size > 0) {\n        s->priv_data = av_mallocz(s->oformat->priv_data_size);\n        if (!s->priv_data)\n            return AVERROR(ENOMEM);\n    }\n#if LIBAVFORMAT_VERSION_MAJOR < 53\n    ff_metadata_mux_compat(s);\n#endif\n    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {\n        AVMetadata *m;\n        AVMetadataTag *t;\n        if (!(m = av_mallocz(sizeof(AVMetadata))))\n            return AVERROR(ENOMEM);\n        av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0);\n        metadata_conv(&m, s->oformat->metadata_conv, NULL);\n        if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX)))\n            av_metadata_set2(&s->metadata, t->key, t->value, 0);\n        av_metadata_free(&m);\n    }\n    if(s->oformat->write_header){\n        ret = s->oformat->write_header(s);\n        if (ret < 0)\n            return ret;\n    }\n    for(i=0;i<s->nb_streams;i++) {\n        int64_t den = AV_NOPTS_VALUE;\n        st = s->streams[i];\n        switch (st->codec->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            den = (int64_t)st->time_base.num * st->codec->sample_rate;\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            den = (int64_t)st->time_base.num * st->codec->time_base.den;\n            break;\n        default:\n            break;\n        }\n        if (den != AV_NOPTS_VALUE) {\n            if (den <= 0)\n                return AVERROR_INVALIDDATA;\n            av_frac_init(&st->pts, 0, 0, den);\n        }\n    }\n    return 0;\n}', 'size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)\n{\n    int i, len, ret = 0;\n    for (i = 0; i < 4; i++) {\n        len = snprintf(buf, buf_size,\n                       isprint(codec_tag&0xFF) ? "%c" : "[%d]", codec_tag&0xFF);\n        buf      += len;\n        buf_size  = buf_size > len ? buf_size - len : 0;\n        ret      += len;\n        codec_tag>>=8;\n    }\n    return ret;\n}']