# HG changeset patch # User reimar # Date 1410977782 0 # Node ID 32aab8a15bfca202cf4f17a82add030d3c2ebc78 # Parent db6c0aa280ffb14bc2b0bfb7c1c00b106576c14c bluray: Fix STREAM_CTRL_SEEK_TO_TIME for out-of-bound values. diff -r db6c0aa280ff -r 32aab8a15bfc stream/stream_bluray.c --- a/stream/stream_bluray.c Wed Sep 17 18:00:19 2014 +0000 +++ b/stream/stream_bluray.c Wed Sep 17 18:16:22 2014 +0000 @@ -219,7 +219,14 @@ *(double *)arg = bd_tell_time(b->bd) / 90000.0; return STREAM_OK; case STREAM_CTRL_SEEK_TO_TIME: { - int64_t res = bd_seek_time(b->bd, *(double*)arg * 90000.0); + int64_t res; + double target = *(double*)arg * 90000.0; + BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); + // clamp to ensure that out-of-bounds seeks do not simply do nothing. + target = FFMAX(target, 0); + if (ti && ti->duration > 1) + target = FFMIN(target, ti->duration - 1); + res = bd_seek_time(b->bd, target); if (res < 0) return STREAM_ERROR; s->pos = res;