From 3359246d9a47c3f4418d994853efe17324a0159b Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 14 Sep 2011 19:26:48 +0200 Subject: [PATCH] mxfdec: check return value of avio_seek Avoid modifying state if avio_seek fails. Signed-off-by: Janne Grunau --- libavformat/mxfdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 38e98a3..44dca69 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1127,13 +1127,16 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti { AVStream *st = s->streams[stream_index]; int64_t seconds; + int ret; if (!s->bit_rate) return AVERROR_INVALIDDATA; if (sample_time < 0) sample_time = 0; seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); - avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); + + if ((ret = avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET)) < 0) + return ret; ff_update_cur_dts(s, st, sample_time); return 0; } -- 2.7.4