libavformat/flvdec.c:837: error: Uninitialized Value
  The value read from size was never initialized.

libavformat/flvdec.c:837:9: 
835.         }
836.     } else {
837.         size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1);
             ^
838.     }
839. 

static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    FLVContext *flv = s->priv_data;
    int ret, i, type, size, flags, is_audio;
    int64_t next, pos;
    int64_t dts, pts = AV_NOPTS_VALUE;
    int sample_rate = 0, channels = 0;
    AVStream *st    = NULL;
    for (;; avio_skip(s->pb, 4)) {
        pos  = avio_tell(s->pb);
        type = avio_r8(s->pb);
        size = avio_rb24(s->pb);
        dts  = avio_rb24(s->pb);
        dts |= avio_r8(s->pb) << 24;
        av_dlog(s, "type:%d, size:%d, dts:%"PRId64"\n", type, size, dts);
        if (s->pb->eof_reached)
            return AVERROR_EOF;
        avio_skip(s->pb, 3);
        flags = 0;
        if (flv->validate_next < flv->validate_count) {
            int64_t validate_pos = flv->validate_index[flv->validate_next].pos;
            if (pos == validate_pos) {
                if (FFABS(dts - flv->validate_index[flv->validate_next].dts) <=
                    VALIDATE_INDEX_TS_THRESH) {
                    flv->validate_next++;
                } else {
                    clear_index_entries(s, validate_pos);
                    flv->validate_count = 0;
                }
            } else if (pos > validate_pos) {
                clear_index_entries(s, validate_pos);
                flv->validate_count = 0;
            }
        }
        if (size == 0)
            continue;
        next = size + avio_tell(s->pb);
        if (type == FLV_TAG_TYPE_AUDIO) {
            is_audio = 1;
            flags    = avio_r8(s->pb);
            size--;
        } else if (type == FLV_TAG_TYPE_VIDEO) {
            is_audio = 0;
            flags    = avio_r8(s->pb);
            size--;
            if ((flags & 0xf0) == 0x50)
                goto skip;
        } else {
            if (type == FLV_TAG_TYPE_META && size > 13 + 1 + 4)
                if (flv_read_metabody(s, next) > 0) {
                    return flv_data_packet(s, pkt, dts, next);
                } else
                    av_log(s, AV_LOG_DEBUG,
                           "skipping flv packet: type %d, size %d, flags %d\n",
                           type, size, flags);
skip:
            avio_seek(s->pb, next, SEEK_SET);
            continue;
        }
        if (!size)
            continue;
        for (i = 0; i < s->nb_streams; i++) {
            st = s->streams[i];
            if (is_audio && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
                if (flv_same_audio_codec(st->codec, flags))
                    break;
            } else if (!is_audio &&
                       st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
                if (flv_same_video_codec(st->codec, flags))
                    break;
            }
        }
        if (i == s->nb_streams)
            st = create_stream(s, is_audio ? AVMEDIA_TYPE_AUDIO
                                           : AVMEDIA_TYPE_VIDEO);
        av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard);
        if ((st->discard >= AVDISCARD_NONKEY &&
             !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) ||
            (st->discard >= AVDISCARD_BIDIR &&
             ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) ||
            st->discard >= AVDISCARD_ALL) {
            avio_seek(s->pb, next, SEEK_SET);
            continue;
        }
        if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
            av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
        break;
    }
    if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE)) {
        int size;
        const int64_t pos   = avio_tell(s->pb);
        const int64_t fsize = avio_size(s->pb);
        avio_seek(s->pb, fsize - 4, SEEK_SET);
        size = avio_rb32(s->pb);
        avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
        if (size == avio_rb24(s->pb) + 11) {
            uint32_t ts = avio_rb24(s->pb);
            ts         |= avio_r8(s->pb) << 24;
            s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
        }
        avio_seek(s->pb, pos, SEEK_SET);
    }
    if (is_audio) {
        int bits_per_coded_sample;
        channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
        sample_rate = 44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >>
                                FLV_AUDIO_SAMPLERATE_OFFSET) >> 3;
        bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
        if (!st->codec->channels || !st->codec->sample_rate ||
            !st->codec->bits_per_coded_sample) {
            st->codec->channels              = channels;
            st->codec->channel_layout        = channels == 1
                                               ? AV_CH_LAYOUT_MONO
                                               : AV_CH_LAYOUT_STEREO;
            st->codec->sample_rate           = sample_rate;
            st->codec->bits_per_coded_sample = bits_per_coded_sample;
        }
        if (!st->codec->codec_id) {
            flv_set_audio_codec(s, st, st->codec,
                                flags & FLV_AUDIO_CODECID_MASK);
            flv->last_sample_rate =
            sample_rate           = st->codec->sample_rate;
            flv->last_channels    =
            channels              = st->codec->channels;
        } else {
            AVCodecContext ctx;
            ctx.sample_rate = sample_rate;
            flv_set_audio_codec(s, st, &ctx, flags & FLV_AUDIO_CODECID_MASK);
            sample_rate = ctx.sample_rate;
        }
    } else {
        size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1);
    }
    if (st->codec->codec_id == AV_CODEC_ID_AAC ||
        st->codec->codec_id == AV_CODEC_ID_H264) {
        int type = avio_r8(s->pb);
        size--;
        if (st->codec->codec_id == AV_CODEC_ID_H264) {
            int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;
            pts = dts + cts;
            if (cts < 0) {
                flv->wrong_dts = 1;
                av_log(s, AV_LOG_WARNING,
                       "negative cts, previous timestamps might be wrong\n");
            }
            if (flv->wrong_dts)
                dts = AV_NOPTS_VALUE;
        }
        if (type == 0) {
            if (st->codec->extradata) {
                if ((ret = flv_queue_extradata(flv, s->pb, is_audio, size)) < 0)
                    return ret;
                ret = AVERROR(EAGAIN);
                goto leave;
            }
            if ((ret = flv_get_extradata(s, st, size)) < 0)
                return ret;
            if (st->codec->codec_id == AV_CODEC_ID_AAC) {
                MPEG4AudioConfig cfg;
                avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
                                             st->codec->extradata_size * 8, 1);
                st->codec->channels       = cfg.channels;
                st->codec->channel_layout = 0;
                if (cfg.ext_sample_rate)
                    st->codec->sample_rate = cfg.ext_sample_rate;
                else
                    st->codec->sample_rate = cfg.sample_rate;
                av_dlog(s, "mp4a config channels %d sample rate %d\n",
                        st->codec->channels, st->codec->sample_rate);
            }
            ret = AVERROR(EAGAIN);
            goto leave;
        }
    }
    if (!size) {
        ret = AVERROR(EAGAIN);
        goto leave;
    }
    ret = av_get_packet(s->pb, pkt, size);
    if (ret < 0)
        return AVERROR(EIO);
    pkt->size         = ret;
    pkt->dts          = dts;
    pkt->pts          = pts == AV_NOPTS_VALUE ? dts : pts;
    pkt->stream_index = st->index;
    if (flv->new_extradata[is_audio]) {
        uint8_t *side = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
                                                flv->new_extradata_size[is_audio]);
        if (side) {
            memcpy(side, flv->new_extradata[is_audio],
                   flv->new_extradata_size[is_audio]);
            av_freep(&flv->new_extradata[is_audio]);
            flv->new_extradata_size[is_audio] = 0;
        }
    }
    if (is_audio && (sample_rate != flv->last_sample_rate ||
                     channels    != flv->last_channels)) {
        flv->last_sample_rate = sample_rate;
        flv->last_channels    = channels;
        ff_add_param_change(pkt, channels, 0, sample_rate, 0, 0);
    }
    if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))
        pkt->flags |= AV_PKT_FLAG_KEY;
leave:
    avio_skip(s->pb, 4);
    return ret;
}
['static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)\n{\n    FLVContext *flv = s->priv_data;\n    int ret, i, type, size, flags, is_audio;\n    int64_t next, pos;\n    int64_t dts, pts = AV_NOPTS_VALUE;\n    int sample_rate = 0, channels = 0;\n    AVStream *st    = NULL;\n    for (;; avio_skip(s->pb, 4)) {\n        pos  = avio_tell(s->pb);\n        type = avio_r8(s->pb);\n        size = avio_rb24(s->pb);\n        dts  = avio_rb24(s->pb);\n        dts |= avio_r8(s->pb) << 24;\n        av_dlog(s, "type:%d, size:%d, dts:%"PRId64"\\n", type, size, dts);\n        if (s->pb->eof_reached)\n            return AVERROR_EOF;\n        avio_skip(s->pb, 3);\n        flags = 0;\n        if (flv->validate_next < flv->validate_count) {\n            int64_t validate_pos = flv->validate_index[flv->validate_next].pos;\n            if (pos == validate_pos) {\n                if (FFABS(dts - flv->validate_index[flv->validate_next].dts) <=\n                    VALIDATE_INDEX_TS_THRESH) {\n                    flv->validate_next++;\n                } else {\n                    clear_index_entries(s, validate_pos);\n                    flv->validate_count = 0;\n                }\n            } else if (pos > validate_pos) {\n                clear_index_entries(s, validate_pos);\n                flv->validate_count = 0;\n            }\n        }\n        if (size == 0)\n            continue;\n        next = size + avio_tell(s->pb);\n        if (type == FLV_TAG_TYPE_AUDIO) {\n            is_audio = 1;\n            flags    = avio_r8(s->pb);\n            size--;\n        } else if (type == FLV_TAG_TYPE_VIDEO) {\n            is_audio = 0;\n            flags    = avio_r8(s->pb);\n            size--;\n            if ((flags & 0xf0) == 0x50)\n                goto skip;\n        } else {\n            if (type == FLV_TAG_TYPE_META && size > 13 + 1 + 4)\n                if (flv_read_metabody(s, next) > 0) {\n                    return flv_data_packet(s, pkt, dts, next);\n                } else\n                    av_log(s, AV_LOG_DEBUG,\n                           "skipping flv packet: type %d, size %d, flags %d\\n",\n                           type, size, flags);\nskip:\n            avio_seek(s->pb, next, SEEK_SET);\n            continue;\n        }\n        if (!size)\n            continue;\n        for (i = 0; i < s->nb_streams; i++) {\n            st = s->streams[i];\n            if (is_audio && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {\n                if (flv_same_audio_codec(st->codec, flags))\n                    break;\n            } else if (!is_audio &&\n                       st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {\n                if (flv_same_video_codec(st->codec, flags))\n                    break;\n            }\n        }\n        if (i == s->nb_streams)\n            st = create_stream(s, is_audio ? AVMEDIA_TYPE_AUDIO\n                                           : AVMEDIA_TYPE_VIDEO);\n        av_dlog(s, "%d %X %d \\n", is_audio, flags, st->discard);\n        if ((st->discard >= AVDISCARD_NONKEY &&\n             !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) ||\n            (st->discard >= AVDISCARD_BIDIR &&\n             ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) ||\n            st->discard >= AVDISCARD_ALL) {\n            avio_seek(s->pb, next, SEEK_SET);\n            continue;\n        }\n        if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)\n            av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);\n        break;\n    }\n    if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE)) {\n        int size;\n        const int64_t pos   = avio_tell(s->pb);\n        const int64_t fsize = avio_size(s->pb);\n        avio_seek(s->pb, fsize - 4, SEEK_SET);\n        size = avio_rb32(s->pb);\n        avio_seek(s->pb, fsize - 3 - size, SEEK_SET);\n        if (size == avio_rb24(s->pb) + 11) {\n            uint32_t ts = avio_rb24(s->pb);\n            ts         |= avio_r8(s->pb) << 24;\n            s->duration = ts * (int64_t)AV_TIME_BASE / 1000;\n        }\n        avio_seek(s->pb, pos, SEEK_SET);\n    }\n    if (is_audio) {\n        int bits_per_coded_sample;\n        channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;\n        sample_rate = 44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >>\n                                FLV_AUDIO_SAMPLERATE_OFFSET) >> 3;\n        bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;\n        if (!st->codec->channels || !st->codec->sample_rate ||\n            !st->codec->bits_per_coded_sample) {\n            st->codec->channels              = channels;\n            st->codec->channel_layout        = channels == 1\n                                               ? AV_CH_LAYOUT_MONO\n                                               : AV_CH_LAYOUT_STEREO;\n            st->codec->sample_rate           = sample_rate;\n            st->codec->bits_per_coded_sample = bits_per_coded_sample;\n        }\n        if (!st->codec->codec_id) {\n            flv_set_audio_codec(s, st, st->codec,\n                                flags & FLV_AUDIO_CODECID_MASK);\n            flv->last_sample_rate =\n            sample_rate           = st->codec->sample_rate;\n            flv->last_channels    =\n            channels              = st->codec->channels;\n        } else {\n            AVCodecContext ctx;\n            ctx.sample_rate = sample_rate;\n            flv_set_audio_codec(s, st, &ctx, flags & FLV_AUDIO_CODECID_MASK);\n            sample_rate = ctx.sample_rate;\n        }\n    } else {\n        size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1);\n    }\n    if (st->codec->codec_id == AV_CODEC_ID_AAC ||\n        st->codec->codec_id == AV_CODEC_ID_H264) {\n        int type = avio_r8(s->pb);\n        size--;\n        if (st->codec->codec_id == AV_CODEC_ID_H264) {\n            int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;\n            pts = dts + cts;\n            if (cts < 0) {\n                flv->wrong_dts = 1;\n                av_log(s, AV_LOG_WARNING,\n                       "negative cts, previous timestamps might be wrong\\n");\n            }\n            if (flv->wrong_dts)\n                dts = AV_NOPTS_VALUE;\n        }\n        if (type == 0) {\n            if (st->codec->extradata) {\n                if ((ret = flv_queue_extradata(flv, s->pb, is_audio, size)) < 0)\n                    return ret;\n                ret = AVERROR(EAGAIN);\n                goto leave;\n            }\n            if ((ret = flv_get_extradata(s, st, size)) < 0)\n                return ret;\n            if (st->codec->codec_id == AV_CODEC_ID_AAC) {\n                MPEG4AudioConfig cfg;\n                avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,\n                                             st->codec->extradata_size * 8, 1);\n                st->codec->channels       = cfg.channels;\n                st->codec->channel_layout = 0;\n                if (cfg.ext_sample_rate)\n                    st->codec->sample_rate = cfg.ext_sample_rate;\n                else\n                    st->codec->sample_rate = cfg.sample_rate;\n                av_dlog(s, "mp4a config channels %d sample rate %d\\n",\n                        st->codec->channels, st->codec->sample_rate);\n            }\n            ret = AVERROR(EAGAIN);\n            goto leave;\n        }\n    }\n    if (!size) {\n        ret = AVERROR(EAGAIN);\n        goto leave;\n    }\n    ret = av_get_packet(s->pb, pkt, size);\n    if (ret < 0)\n        return AVERROR(EIO);\n    pkt->size         = ret;\n    pkt->dts          = dts;\n    pkt->pts          = pts == AV_NOPTS_VALUE ? dts : pts;\n    pkt->stream_index = st->index;\n    if (flv->new_extradata[is_audio]) {\n        uint8_t *side = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,\n                                                flv->new_extradata_size[is_audio]);\n        if (side) {\n            memcpy(side, flv->new_extradata[is_audio],\n                   flv->new_extradata_size[is_audio]);\n            av_freep(&flv->new_extradata[is_audio]);\n            flv->new_extradata_size[is_audio] = 0;\n        }\n    }\n    if (is_audio && (sample_rate != flv->last_sample_rate ||\n                     channels    != flv->last_channels)) {\n        flv->last_sample_rate = sample_rate;\n        flv->last_channels    = channels;\n        ff_add_param_change(pkt, channels, 0, sample_rate, 0, 0);\n    }\n    if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))\n        pkt->flags |= AV_PKT_FLAG_KEY;\nleave:\n    avio_skip(s->pb, 4);\n    return ret;\n}']