[DVDnav-discuss] r1018 - in trunk/libdvdnav/src: navigation.c vm/vm.c

nicodvb subversion at mplayerhq.hu
Sun Apr 20 10:29:03 CEST 2008


Author: nicodvb
Date: Sun Apr 20 10:29:02 2008
New Revision: 1018

Log:
in get_PGCIT() check the validity of vm->vtsi before risking to dereference NULL; also change dvdnav_get_current_menu() accordingly\npatch by Erik Hovland - erik hovland org

Modified:
   trunk/libdvdnav/src/navigation.c
   trunk/libdvdnav/src/vm/vm.c

Modified: trunk/libdvdnav/src/navigation.c
==============================================================================
--- trunk/libdvdnav/src/navigation.c	(original)
+++ trunk/libdvdnav/src/navigation.c	Sun Apr 20 10:29:02 2008
@@ -104,7 +104,10 @@ dvdnav_status_t dvdnav_current_title_inf
   if ( (this->vm->state.domain == VTSM_DOMAIN)
       || (this->vm->state.domain == VMGM_DOMAIN) ) {
     /* Get current Menu ID: into *part. */
-    vm_get_current_menu(this->vm, part);
+    if(! vm_get_current_menu(this->vm, part)) {
+      pthread_mutex_unlock(&this->vm_lock);
+      return DVDNAV_STATUS_ERR;
+    }
     if (*part > -1) {
       *title = 0;
       pthread_mutex_unlock(&this->vm_lock);

Modified: trunk/libdvdnav/src/vm/vm.c
==============================================================================
--- trunk/libdvdnav/src/vm/vm.c	(original)
+++ trunk/libdvdnav/src/vm/vm.c	Sun Apr 20 10:29:02 2008
@@ -1823,13 +1823,15 @@ static pgcit_t* get_MENU_PGCIT(vm_t *vm,
 
 /* Uses state to decide what to return */
 static pgcit_t* get_PGCIT(vm_t *vm) {
-  pgcit_t *pgcit;
+  pgcit_t *pgcit = NULL;
   
   switch ((vm->state).domain) {
   case VTS_DOMAIN:
+    if(!vm->vtsi) return NULL;
     pgcit = vm->vtsi->vts_pgcit;
     break;
   case VTSM_DOMAIN:
+    if(!vm->vtsi) return NULL;
     pgcit = get_MENU_PGCIT(vm, vm->vtsi, (vm->state).registers.SPRM[0]);
     break;
   case VMGM_DOMAIN:



More information about the DVDnav-discuss mailing list