[libbluray-devel] bd_seek_time(): validate timestamp

hpi1 git at videolan.org
Fri Nov 7 12:12:32 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Nov  7 12:58:03 2014 +0200| [9552cc2ee38b286970b10f3317fdc82f220adccc] | committer: hpi1

bd_seek_time(): validate timestamp

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9552cc2ee38b286970b10f3317fdc82f220adccc
---

 src/libbluray/bluray.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 9114ba4..7ddfbec 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1579,6 +1579,11 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
     uint32_t clip_pkt, out_pkt;
     NAV_CLIP *clip;
 
+    if (tick >> 33) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_seek_time("PRIu64") failed: invalid timestamp\n", tick);
+        return bd->s_pos;
+    }
+
     tick /= 2;
 
     bd_mutex_lock(&bd->mutex);
@@ -1589,7 +1594,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
         _change_angle(bd);
 
         // Find the closest access unit to the requested position
-        clip = nav_time_search(bd->title, tick, &clip_pkt, &out_pkt);
+        clip = nav_time_search(bd->title, (uint32_t)tick, &clip_pkt, &out_pkt);
 
         _seek_internal(bd, clip, out_pkt, clip_pkt);
 



More information about the libbluray-devel mailing list