[FFmpeg-cvslog] dv: Check return value of avio_seek and avoid modifying state if it fails

Joakim Plate git at videolan.org
Sat Feb 11 01:35:46 CET 2012


ffmpeg | branch: master | Joakim Plate <elupus at ecce.se> | Fri Feb  3 19:13:36 2012 +0000| [8332321c5737cf24ebad504bf10a03818424718d] | committer: Justin Ruggles

dv: Check return value of avio_seek and avoid modifying state if it fails

Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8332321c5737cf24ebad504bf10a03818424718d
---

 libavformat/dv.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/dv.c b/libavformat/dv.c
index 769f6b7..6714bf2 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -491,10 +491,11 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
     DVDemuxContext *c = r->dv_demux;
     int64_t offset    = dv_frame_offset(s, c, timestamp, flags);
 
-    dv_offset_reset(c, offset / c->sys->frame_size);
+    if (avio_seek(s->pb, offset, SEEK_SET) < 0)
+        return -1;
 
-    offset = avio_seek(s->pb, offset, SEEK_SET);
-    return (offset < 0) ? offset : 0;
+    dv_offset_reset(c, offset / c->sys->frame_size);
+    return 0;
 }
 
 static int dv_read_close(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list