diff dvdread/ifo_read.c @ 255:3e5192f8113f src

Patch from Vradi Istvn. libdvdnav fails on the Fahrenheit 911 DVD. This fixes a problem caused by certain tables having a non-zero offset, but a zero size.
author jcdutton
date Sat, 20 Nov 2004 21:10:25 +0000
parents 12cff2e56f55
children e9dd884a3054
line wrap: on
line diff
--- a/dvdread/ifo_read.c	Fri Oct 22 12:14:12 2004 +0000
+++ b/dvdread/ifo_read.c	Sat Nov 20 21:10:25 2004 +0000
@@ -683,7 +683,7 @@
     pgc->command_tbl = NULL;
   }
   
-  if(pgc->program_map_offset != 0) {
+  if(pgc->program_map_offset != 0 && pgc->nr_of_programs>0) {
     pgc->program_map = malloc(pgc->nr_of_programs * sizeof(pgc_program_map_t));
     if(!pgc->program_map) {
       ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
@@ -699,7 +699,7 @@
     pgc->program_map = NULL;
   }
   
-  if(pgc->cell_playback_offset != 0) {
+  if(pgc->cell_playback_offset != 0 && pgc->nr_of_cells>0) {
     pgc->cell_playback = malloc(pgc->nr_of_cells * sizeof(cell_playback_t));
     if(!pgc->cell_playback) {
       ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
@@ -720,7 +720,7 @@
     pgc->cell_playback = NULL;
   }
   
-  if(pgc->cell_position_offset != 0) {
+  if(pgc->cell_position_offset != 0 && pgc->nr_of_cells>0) {
     pgc->cell_position = malloc(pgc->nr_of_cells * sizeof(cell_position_t));
     if(!pgc->cell_position) {
       ifoFree_PGC(pgc);