libavformat/electronicarts.c:479: error: Integer Overflow L1
  (-12 - 12):unsigned32.

libavformat/electronicarts.c:466:19: <LHS trace>
464.                 chunk_size -= 12;
465.             }
466.             ret = av_get_packet(pb, pkt, chunk_size);
                       ^
467.             if (ret != chunk_size)
468.                 ret = AVERROR(EIO);

libavformat/electronicarts.c:466:19: Call
464.                 chunk_size -= 12;
465.             }
466.             ret = av_get_packet(pb, pkt, chunk_size);
                       ^
467.             if (ret != chunk_size)
468.                 ret = AVERROR(EIO);

libavformat/utils.c:280:14: Call
  278. int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
  279. {
  280.     int ret= av_new_packet(pkt, size);
                    ^
  281. 
  282.     if(ret<0)

libavformat/utils.c:268:9: Assignment
    266.     data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
    267.     if (!data)
    268.         return AVERROR(ENOMEM);
                 ^
    269.     memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
    270. 

libavformat/utils.c:280:5: Assignment
  278. int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
  279. {
  280.     int ret= av_new_packet(pkt, size);
           ^
  281. 
  282.     if(ret<0)

libavformat/utils.c:283:9: Assignment
  281. 
  282.     if(ret<0)
  283.         return ret;
               ^
  284. 
  285.     pkt->pos= url_ftell(s);

libavformat/electronicarts.c:466:13: Assignment
464.                 chunk_size -= 12;
465.             }
466.             ret = av_get_packet(pb, pkt, chunk_size);
                 ^
467.             if (ret != chunk_size)
468.                 ret = AVERROR(EIO);

libavformat/electronicarts.c:479:21: Binary operation: (-12 - 12):unsigned32
477.                     /* 2 samples/byte, 1 or 2 samples per frame depending
478.                      * on stereo; chunk also has 12-byte header */
479.                     ea->audio_frame_counter += ((chunk_size - 12) * 2) /
                         ^
480.                         ea->num_channels;
481.                         break;

static int ea_read_packet(AVFormatContext *s,
                          AVPacket *pkt)
{
    EaDemuxContext *ea = s->priv_data;
    ByteIOContext *pb = s->pb;
    int ret = 0;
    int packet_read = 0;
    unsigned int chunk_type, chunk_size;
    int key = 0;
    int num_samples;
    while (!packet_read) {
        chunk_type = get_le32(pb);
        chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;
        switch (chunk_type) {
        case ISNh_TAG:
            url_fskip(pb, 32);
            chunk_size -= 32;
        case ISNd_TAG:
        case SCDl_TAG:
        case SNDC_TAG:
        case SDEN_TAG:
            if (!ea->audio_codec) {
                url_fskip(pb, chunk_size);
                break;
            } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
                       ea->audio_codec == CODEC_ID_MP3) {
                num_samples = get_le32(pb);
                url_fskip(pb, 8);
                chunk_size -= 12;
            }
            ret = av_get_packet(pb, pkt, chunk_size);
            if (ret != chunk_size)
                ret = AVERROR(EIO);
            else {
                    pkt->stream_index = ea->audio_stream_index;
                    pkt->pts = 90000;
                    pkt->pts *= ea->audio_frame_counter;
                    pkt->pts /= ea->sample_rate;
                    switch (ea->audio_codec) {
                    case CODEC_ID_ADPCM_EA:
                    ea->audio_frame_counter += ((chunk_size - 12) * 2) /
                        ea->num_channels;
                        break;
                    case CODEC_ID_PCM_S16LE_PLANAR:
                    case CODEC_ID_MP3:
                        ea->audio_frame_counter += num_samples;
                        break;
                    default:
                        ea->audio_frame_counter += chunk_size /
                            (ea->bytes * ea->num_channels);
                    }
            }
            packet_read = 1;
            break;
        case 0:
        case ISNe_TAG:
        case SCEl_TAG:
        case SEND_TAG:
        case SEEN_TAG:
            ret = AVERROR(EIO);
            packet_read = 1;
            break;
        case MVIh_TAG:
        case kVGT_TAG:
        case pQGT_TAG:
        case TGQs_TAG:
            key = PKT_FLAG_KEY;
        case MVIf_TAG:
        case fVGT_TAG:
            url_fseek(pb, -8, SEEK_CUR);
            chunk_size += 8;
            goto get_video_packet;
        case mTCD_TAG:
            url_fseek(pb, 8, SEEK_CUR);
            chunk_size -= 8;
            goto get_video_packet;
        case MV0K_TAG:
        case MPCh_TAG:
            key = PKT_FLAG_KEY;
        case MV0F_TAG:
get_video_packet:
            ret = av_get_packet(pb, pkt, chunk_size);
            if (ret != chunk_size)
                ret = AVERROR_IO;
            else {
                pkt->stream_index = ea->video_stream_index;
                pkt->flags |= key;
            }
            packet_read = 1;
            break;
        default:
            url_fseek(pb, chunk_size, SEEK_CUR);
            break;
        }
    }
    return ret;
}
['static int ea_read_packet(AVFormatContext *s,\n                          AVPacket *pkt)\n{\n    EaDemuxContext *ea = s->priv_data;\n    ByteIOContext *pb = s->pb;\n    int ret = 0;\n    int packet_read = 0;\n    unsigned int chunk_type, chunk_size;\n    int key = 0;\n    int num_samples;\n    while (!packet_read) {\n        chunk_type = get_le32(pb);\n        chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;\n        switch (chunk_type) {\n        case ISNh_TAG:\n            url_fskip(pb, 32);\n            chunk_size -= 32;\n        case ISNd_TAG:\n        case SCDl_TAG:\n        case SNDC_TAG:\n        case SDEN_TAG:\n            if (!ea->audio_codec) {\n                url_fskip(pb, chunk_size);\n                break;\n            } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||\n                       ea->audio_codec == CODEC_ID_MP3) {\n                num_samples = get_le32(pb);\n                url_fskip(pb, 8);\n                chunk_size -= 12;\n            }\n            ret = av_get_packet(pb, pkt, chunk_size);\n            if (ret != chunk_size)\n                ret = AVERROR(EIO);\n            else {\n                    pkt->stream_index = ea->audio_stream_index;\n                    pkt->pts = 90000;\n                    pkt->pts *= ea->audio_frame_counter;\n                    pkt->pts /= ea->sample_rate;\n                    switch (ea->audio_codec) {\n                    case CODEC_ID_ADPCM_EA:\n                    ea->audio_frame_counter += ((chunk_size - 12) * 2) /\n                        ea->num_channels;\n                        break;\n                    case CODEC_ID_PCM_S16LE_PLANAR:\n                    case CODEC_ID_MP3:\n                        ea->audio_frame_counter += num_samples;\n                        break;\n                    default:\n                        ea->audio_frame_counter += chunk_size /\n                            (ea->bytes * ea->num_channels);\n                    }\n            }\n            packet_read = 1;\n            break;\n        case 0:\n        case ISNe_TAG:\n        case SCEl_TAG:\n        case SEND_TAG:\n        case SEEN_TAG:\n            ret = AVERROR(EIO);\n            packet_read = 1;\n            break;\n        case MVIh_TAG:\n        case kVGT_TAG:\n        case pQGT_TAG:\n        case TGQs_TAG:\n            key = PKT_FLAG_KEY;\n        case MVIf_TAG:\n        case fVGT_TAG:\n            url_fseek(pb, -8, SEEK_CUR);\n            chunk_size += 8;\n            goto get_video_packet;\n        case mTCD_TAG:\n            url_fseek(pb, 8, SEEK_CUR);\n            chunk_size -= 8;\n            goto get_video_packet;\n        case MV0K_TAG:\n        case MPCh_TAG:\n            key = PKT_FLAG_KEY;\n        case MV0F_TAG:\nget_video_packet:\n            ret = av_get_packet(pb, pkt, chunk_size);\n            if (ret != chunk_size)\n                ret = AVERROR_IO;\n            else {\n                pkt->stream_index = ea->video_stream_index;\n                pkt->flags |= key;\n            }\n            packet_read = 1;\n            break;\n        default:\n            url_fseek(pb, chunk_size, SEEK_CUR);\n            break;\n        }\n    }\n    return ret;\n}', 'int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)\n{\n    int ret= av_new_packet(pkt, size);\n    if(ret<0)\n        return ret;\n    pkt->pos= url_ftell(s);\n    ret= get_buffer(s, pkt->data, size);\n    if(ret<=0)\n        av_free_packet(pkt);\n    else\n        pkt->size= ret;\n    return ret;\n}', 'int av_new_packet(AVPacket *pkt, int size)\n{\n    uint8_t *data;\n    if((unsigned)size > (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)\n        return AVERROR(ENOMEM);\n    data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);\n    if (!data)\n        return AVERROR(ENOMEM);\n    memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);\n    av_init_packet(pkt);\n    pkt->data = data;\n    pkt->size = size;\n    pkt->destruct = av_destruct_packet;\n    return 0;\n}']