[FFmpeg-devel] [PATCH 19/28] changed: check some more url_fseeks in asf demuxer to avoid problems if file system is unseekable

Mans Rullgard mans
Wed Jun 30 11:09:47 CEST 2010


From: Cory Fields <theuni-nospam- at xbmc.org>

---
 libavformat/asfdec.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 40ed9ed..47d6f62 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1068,7 +1068,8 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
     if (s->packet_size > 0)
         pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
     *ppos= pos;
-    url_fseek(s->pb, pos, SEEK_SET);
+    if (url_fseek(s->pb, pos, SEEK_SET) < 0)
+        return AV_NOPTS_VALUE;
 
 //printf("asf_read_pts\n");
     asf_reset_header(s);
@@ -1110,7 +1111,11 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
     int64_t current_pos= url_ftell(s->pb);
     int i;
 
-    url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
+    if(url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0) {
+      asf->index_read= -1;
+      return;
+    }
+
     get_guid(s->pb, &g);
     if (!guidcmp(&g, &index_guid)) {
         int64_t itime, last_pos=-1;
-- 
1.7.1.1




More information about the ffmpeg-devel mailing list