# HG changeset patch # User reimar # Date 1280929756 0 # Node ID 1241f62e54e756e7ef0795509db05e9a8a0a40c2 # Parent 273d401301836ad8fca66b5a145ac49871fa26d5 Return an error when seeking beyond EOF. Avoids an endless loop. diff -r 273d40130183 -r 1241f62e54e7 stream/stream_bd.c --- 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;