[DVDnav-discuss] Bugs in dvdnav_scan_admap
Nico Sabbi
nicola_sabbi at fastwebnet.it
Thu Jul 12 22:18:30 CEST 2007
Gospodin Gyurov wrote:
> 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.
yes
>
> 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;
why does it fail in the last vobu?
>
> 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;
>
>
should be fixed in a slightly different manner.
I appreciate your contributions, but I'd love it you posted proper
patches :-)
Thanks,
Nico
More information about the DVDnav-discuss
mailing list