diff options
author | Joakim Plate <elupus@ecce.se> | 2011-09-12 04:07:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-21 18:03:11 +0200 |
commit | 4a721b18edfdea44643ff9bb6ed80ee176e71f1b (patch) | |
tree | 217d1cd585acdb40a963f0222dbd0f3d657d358f | |
parent | f0869d3721a21c022f564251f93eb095843490f1 (diff) | |
download | ffmpeg-4a721b18edfdea44643ff9bb6ed80ee176e71f1b.tar.gz |
avidec: Check return value of more avio_seek calls
The move of avio_seek in avi_read_seek is to avoiding modifying
state if the seek would fail.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f9e083a156f19094cb6fcd134c1ca4ca899a1a6d)
-rw-r--r-- | libavformat/avidec.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 80620dadba..6fedaf7f8e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -220,13 +220,18 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ return -1; } - avio_seek(pb, offset+8, SEEK_SET); + if(avio_seek(pb, offset+8, SEEK_SET) < 0) + return -1; avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; - avio_seek(pb, pos, SEEK_SET); + if(avio_seek(pb, pos, SEEK_SET) < 0) { + av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index"); + return -1; + } + } } avi->index_loaded=1; @@ -1325,11 +1330,13 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp /* the av_index_search_timestamp call above. */ assert(stream_index == 0); + if(avio_seek(s->pb, pos, SEEK_SET) < 0) + return -1; + /* Feed the DV video stream version of the timestamp to the */ /* DV demux so it can synthesize correct timestamps. */ dv_offset_reset(avi->dv_demux, timestamp); - avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } @@ -1380,7 +1387,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp } /* do the seek */ - avio_seek(s->pb, pos_min, SEEK_SET); + if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) + return -1; avi->stream_index= -1; return 0; } |