X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frl2.c;h=9e10155838f8f09a57df87e98355b467fa2574f3;hb=49cfbedb9d5a35d4701b37e9908172807eb67100;hp=eb1682dfcb7c2983a9a5c06175aac0e470c9e357;hpb=a12063b118ad05409ff775ba30fab00265ad3031;p=ffmpeg diff --git a/libavformat/rl2.c b/libavformat/rl2.c index eb1682dfcb7..9e10155838f 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -55,7 +55,7 @@ typedef struct Rl2DemuxContext { * @param p probe buffer * @return 0 when the probe buffer does not contain rl2 data, > 0 otherwise */ -static int rl2_probe(AVProbeData *p) +static int rl2_probe(const AVProbeData *p) { if(AV_RB32(&p->buf[0]) != FORM_TAG) @@ -127,8 +127,9 @@ static av_cold int rl2_read_header(AVFormatContext *s) if(signature == RLV3_TAG && back_size > 0) st->codecpar->extradata_size += back_size; - if(ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0) - return AVERROR(ENOMEM); + ret = ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size); + if (ret < 0) + return ret; /** setup audio stream if present */ if(sound_rate){ @@ -171,18 +172,24 @@ static av_cold int rl2_read_header(AVFormatContext *s) /** read offset and size tables */ for(i=0; i < frame_count;i++) { - if (avio_feof(pb)) - return AVERROR_INVALIDDATA; + if (avio_feof(pb)) { + ret = AVERROR_INVALIDDATA; + goto end; + } chunk_size[i] = avio_rl32(pb); } for(i=0; i < frame_count;i++) { - if (avio_feof(pb)) - return AVERROR_INVALIDDATA; + if (avio_feof(pb)) { + ret = AVERROR_INVALIDDATA; + goto end; + } chunk_offset[i] = avio_rl32(pb); } for(i=0; i < frame_count;i++) { - if (avio_feof(pb)) - return AVERROR_INVALIDDATA; + if (avio_feof(pb)) { + ret = AVERROR_INVALIDDATA; + goto end; + } audio_size[i] = avio_rl32(pb) & 0xFFFF; } @@ -203,7 +210,7 @@ static av_cold int rl2_read_header(AVFormatContext *s) ++video_frame_counter; } - +end: av_free(chunk_size); av_free(audio_size); av_free(chunk_offset);