[DVDnav-discuss] Bugs in dvdnav_scan_admap

Gospodin Gyurov ggurov at abv.bg
Thu Jul 12 12:26:57 CEST 2007


Two bugs in dvdnav_scan_admap (in searching.c):

while((!found) && ((address<<2) < admap->last_byte)) {

must be:
while((!found) && ((address<<2) < (admap->last_byte - VOBU_ADMAP_SIZE))) {

because admap is 4 bytes longer than the array with vobu start sectors. See ifoRead_VOBU_ADMAP_internal (in ifo_read.c) for evidence.

Also, this function always fails when it is used for blocks from the last VOBU. Due to this I prefer instead of the code after the 'while' loop:
---------
if(found) {
  *vobu = vobu_start;
  return DVDNAV_STATUS_OK;
} else {
  fprintf(MSG_OUT, "libdvdnav: Could not locate block\n");
  return DVDNAV_STATUS_ERR;
}
---------
just this:

*vobu = vobu_start;
return DVDNAV_STATUS_OK;

In the last case the variable 'found' can be eliminated, in the loop instead of:

found = 1; 

there can be:

break;

If there must be check for the case of empty cell (cell without vobu; is this possible?), with no 'found' variable this can be done with such code (just before 'while') :

if ( admap->last_byte < VOBU_ADMAP_SIZE )
  return DVDNAV_STATUS_ERR;


-----------------------------------------------------------------
С бензин в кръвта!
http://auto-motor-und-sport.bg/



More information about the DVDnav-discuss mailing list