diff options
author | Joakim Plate <elupus@ecce.se> | 2012-02-03 23:13:37 +0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-11 00:27:49 +0400 |
commit | d7c11b114b0d75aecf0e62116971dfa5724a9ab8 (patch) | |
tree | d41b331209a1e9016c09f25671131099a4ceaef2 /libavformat | |
parent | 8332321c5737cf24ebad504bf10a03818424718d (diff) |
ffmdec: Check return value of avio_seek and avoid modifying state if it fails
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/ffmdec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 259b6ead3f..089609f3ee 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -167,7 +167,7 @@ static int ffm_read_data(AVFormatContext *s, /* ensure that acutal seeking happens between FFM_PACKET_SIZE and file_size - FFM_PACKET_SIZE */ -static void ffm_seek1(AVFormatContext *s, int64_t pos1) +static int64_t ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; AVIOContext *pb = s->pb; @@ -176,7 +176,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE); av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); - avio_seek(pb, pos, SEEK_SET); + return avio_seek(pb, pos, SEEK_SET); } static int64_t get_dts(AVFormatContext *s, int64_t pos) @@ -487,7 +487,8 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; found: - ffm_seek1(s, pos); + if (ffm_seek1(s, pos) < 0) + return -1; /* reset read state */ ffm->read_state = READ_HEADER; |