libavformat/apetag.c:147: error: Integer Overflow L2
  ([-16777216, +oo] - 32):unsigned32.

libavformat/apetag.c:119:21: <LHS trace>
117. {
118.     AVIOContext *pb = s->pb;
119.     int file_size = avio_size(pb);
                         ^
120.     uint32_t val, fields, tag_bytes;
121.     uint8_t buf[8];

libavformat/apetag.c:119:21: Call
117. {
118.     AVIOContext *pb = s->pb;
119.     int file_size = avio_size(pb);
                         ^
120.     uint32_t val, fields, tag_bytes;
121.     uint8_t buf[8];

libavformat/aviobuf.c:242:9: Assignment
  240. 
  241.     if(!s)
  242.         return AVERROR(EINVAL);
               ^
  243. 
  244.     if (!s->seek)

libavformat/apetag.c:119:5: Assignment
117. {
118.     AVIOContext *pb = s->pb;
119.     int file_size = avio_size(pb);
         ^
120.     uint32_t val, fields, tag_bytes;
121.     uint8_t buf[8];

libavformat/apetag.c:147:5: Binary operation: ([-16777216, +oo] - 32):unsigned32
145.     }
146. 
147.     tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
         ^
148.     if (tag_start < 0) {
149.         av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes);

int64_t ff_ape_parse_tag(AVFormatContext *s)
{
    AVIOContext *pb = s->pb;
    int file_size = avio_size(pb);
    uint32_t val, fields, tag_bytes;
    uint8_t buf[8];
    int64_t tag_start;
    int i;
    if (file_size < APE_TAG_FOOTER_BYTES)
        return 0;
    avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
    avio_read(pb, buf, 8);
    if (strncmp(buf, "APETAGEX", 8)) {
        return 0;
    }
    val = avio_rl32(pb);
    if (val > APE_TAG_VERSION) {
        av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
        return 0;
    }
    tag_bytes = avio_rl32(pb);
    if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
        av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
        return 0;
    }
    tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
    if (tag_start < 0) {
        av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes);
        return 0;
    }
    fields = avio_rl32(pb);
    if (fields > 65536) {
        av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
        return 0;
    }
    val = avio_rl32(pb);
    if (val & APE_TAG_FLAG_IS_HEADER) {
        av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
        return 0;
    }
    avio_seek(pb, file_size - tag_bytes, SEEK_SET);
    for (i=0; i<fields; i++)
        if (ape_tag_read_field(s) < 0) break;
    return tag_start;
}
['int64_t ff_ape_parse_tag(AVFormatContext *s)\n{\n    AVIOContext *pb = s->pb;\n    int file_size = avio_size(pb);\n    uint32_t val, fields, tag_bytes;\n    uint8_t buf[8];\n    int64_t tag_start;\n    int i;\n    if (file_size < APE_TAG_FOOTER_BYTES)\n        return 0;\n    avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);\n    avio_read(pb, buf, 8);\n    if (strncmp(buf, "APETAGEX", 8)) {\n        return 0;\n    }\n    val = avio_rl32(pb);\n    if (val > APE_TAG_VERSION) {\n        av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\\n", APE_TAG_VERSION);\n        return 0;\n    }\n    tag_bytes = avio_rl32(pb);\n    if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {\n        av_log(s, AV_LOG_ERROR, "Tag size is way too big\\n");\n        return 0;\n    }\n    tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;\n    if (tag_start < 0) {\n        av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\\n", tag_bytes);\n        return 0;\n    }\n    fields = avio_rl32(pb);\n    if (fields > 65536) {\n        av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\\n", fields);\n        return 0;\n    }\n    val = avio_rl32(pb);\n    if (val & APE_TAG_FLAG_IS_HEADER) {\n        av_log(s, AV_LOG_ERROR, "APE Tag is a header\\n");\n        return 0;\n    }\n    avio_seek(pb, file_size - tag_bytes, SEEK_SET);\n    for (i=0; i<fields; i++)\n        if (ape_tag_read_field(s) < 0) break;\n    return tag_start;\n}', 'int64_t avio_size(AVIOContext *s)\n{\n    int64_t size;\n    if(!s)\n        return AVERROR(EINVAL);\n    if (!s->seek)\n        return AVERROR(ENOSYS);\n    size = s->seek(s->opaque, 0, AVSEEK_SIZE);\n    if(size<0){\n        if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)\n            return size;\n        size++;\n        s->seek(s->opaque, s->pos, SEEK_SET);\n    }\n    return size;\n}']