summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Stembridge <jstembridge@users.sourceforge.net>2004-08-19 19:59:14 +0000
committerJames Stembridge <jstembridge@users.sourceforge.net>2004-08-19 19:59:14 +0000
commita51c09fc68c5adb8ce7c0855e9a35a191e3515fa (patch)
tree5b8bc95e8bf59d1576b865ad5dfc4a18930f0e5b
parent9d90f1ef5c37605a99b6f85479f15bd3624dd605 (diff)
downloadxine-lib-a51c09fc68c5adb8ce7c0855e9a35a191e3515fa.tar.gz
xine-lib-a51c09fc68c5adb8ce7c0855e9a35a191e3515fa.tar.bz2
Don't read past end of index when seeking to end of file
CVS patchset: 6901 CVS date: 2004/08/19 19:59:14
-rw-r--r--src/demuxers/demux_real.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 23298ec32..789d623b4 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -31,7 +31,7 @@
*
* Based on FFmpeg's libav/rm.c.
*
- * $Id: demux_real.c,v 1.102 2004/08/17 19:49:51 jstembridge Exp $
+ * $Id: demux_real.c,v 1.103 2004/08/19 19:59:14 jstembridge Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1442,11 +1442,12 @@ static int demux_real_seek (demux_plugin_t *this_gen,
other_index = this->video_stream->index;
}
+ /* FIXME: binary search would be quicker */
if(start_pos) {
- while((index[i+1].offset < start_pos) && (i < entries - 1))
+ while((i < entries - 1) && (index[i+1].offset < start_pos))
i++;
} else if(start_time) {
- while((index[i+1].timestamp < start_time) && (i < entries - 1))
+ while((i < entries - 1) && (index[i+1].timestamp < start_time))
i++;
}