Mercurial > mplayer.hg
changeset 31848:1241f62e54e7
Return an error when seeking beyond EOF.
Avoids an endless loop.
author | reimar |
---|---|
date | Wed, 04 Aug 2010 13:49:16 +0000 |
parents | 273d40130183 |
children | 542ad87bf1b9 |
files | stream/stream_bd.c |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_bd.c Wed Aug 04 13:39:10 2010 +0000 +++ b/stream/stream_bd.c Wed Aug 04 13:49:16 2010 +0000 @@ -107,6 +107,11 @@ // must seek to start of unit pos -= pos % BD_UNIT_SIZE; + if (fseek(bd->title_file, pos, SEEK_SET) < 0) { + s->eof = 1; + return 0; + } + bd->pos = pos; s->pos = pos; @@ -257,8 +262,6 @@ if (!len) return 0; - fseek(bd->title_file, bd->pos, SEEK_SET); - read_len = fread(buf, 1, len, bd->title_file); if (read_len != len) return -1;