summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authortholin <tholin@nowhere>2014-07-03 23:19:12 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-07-05 00:29:01 +0200
commit9b18ed8d8b223a726a31c4ee9c8932023bdbb6e3 (patch)
treee3ed1ffc00fa1e4fecc154fc3b734b60a5c2576b /stream
parent5dce714dfeeb5be9efbc5253bdf8c8fa857f802b (diff)
downloadmpv-9b18ed8d8b223a726a31c4ee9c8932023bdbb6e3.tar.bz2
mpv-9b18ed8d8b223a726a31c4ee9c8932023bdbb6e3.tar.xz
stream_dvdnav: make sure seeking bounds are within range
libdvdnav returns an error is the seek position is out of range. CC: @mpv-player/stable Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_dvdnav.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 59f10f6103..cc6c16ae9b 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -546,7 +546,11 @@ static int control(stream_t *stream, int cmd, void *arg)
return STREAM_OK;
}
case STREAM_CTRL_SEEK_TO_TIME: {
- uint64_t tm = (uint64_t) (*((double *)arg) * 90000);
+ int64_t tm = (int64_t) (*((double *)arg) * 90000);
+ if (tm < 0)
+ tm = 0;
+ if (priv->duration && tm >= (priv->duration * 90))
+ tm = priv->duration * 90 - 1;
MP_VERBOSE(stream, "seek to PTS %"PRId64"\n", tm);
if (dvdnav_time_search(dvdnav, tm) != DVDNAV_STATUS_OK)
break;