summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortholin <tholin@nowhere>2014-07-03 23:19:12 +0200
committerwm4 <wm4@nowhere>2014-07-04 02:24:50 +0200
commit4bd75313d1cc213c2671ecb3370dd99cd9103300 (patch)
treee24a9d00b4fb966fd76043d06a4a739e2558fcb8
parentfe4fbb5775f3c663248c1341667e57529c37a114 (diff)
downloadmpv-4bd75313d1cc213c2671ecb3370dd99cd9103300.tar.bz2
mpv-4bd75313d1cc213c2671ecb3370dd99cd9103300.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>
-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;