[libbluray-devel] nav_time_search(): added sanity checks

hpi1 git at videolan.org
Thu Apr 11 14:43:45 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 11 09:45:05 2013 +0300| [70a53e7925fd452827208c8e0336d36e3f8e9904] | committer: hpi1

nav_time_search(): added sanity checks

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

 src/libbluray/bdnav/navigation.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index e86d390..c8dc307 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -706,10 +706,19 @@ uint32_t nav_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time)
 NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt)
 {
     uint32_t pos, len;
-    MPLS_PI *pi;
+    MPLS_PI *pi = NULL;
     NAV_CLIP *clip;
     unsigned ii;
 
+    if (!title->pl) {
+        BD_DEBUG(DBG_NAV | DBG_CRIT, "Time search failed (title not opened)\n");
+        return NULL;
+    }
+    if (title->pl->list_count < 1) {
+        BD_DEBUG(DBG_NAV | DBG_CRIT, "Time search failed (empty playlist)\n");
+        return NULL;
+    }
+
     pos = 0;
     for (ii = 0; ii < title->pl->list_count; ii++) {
         pi = &title->pl->play_item[ii];



More information about the libbluray-devel mailing list