]> git.sesse.net Git - ffmpeg/commitdiff
dv: Check return value of avio_seek and avoid modifying state if it fails
authorJoakim Plate <elupus@ecce.se>
Fri, 3 Feb 2012 19:13:36 +0000 (19:13 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Fri, 10 Feb 2012 20:27:49 +0000 (15:27 -0500)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
libavformat/dv.c

index 769f6b74f42161b2c5ae574fcb16e2e5680a92d2..6714bf2afcfeba91dcc3d2c58f40f57086655122 100644 (file)
@@ -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)