# HG changeset patch # User nicodvb # Date 1184270985 0 # Node ID 52cda7471a246a7b05e4e7e369917a10f34a2496 # Parent ef017423e37c2bec0985803c06ad9bc66b556b4e fixed off-by-one bug in scan_admap (copied reference code from ifo_print.c); reported by ggurov+abv-bg diff -r ef017423e37c -r 52cda7471a24 searching.c --- a/searching.c Wed Jul 11 21:53:36 2007 +0000 +++ b/searching.c Thu Jul 12 20:09:45 2007 +0000 @@ -79,11 +79,12 @@ uint32_t address = 0; uint32_t vobu_start, next_vobu; int32_t found = 0; + int admap_entries = (admap->last_byte + 1 - VOBU_ADMAP_SIZE)/VOBU_ADMAP_SIZE; /* Search through ADMAP for best sector */ vobu_start = SRI_END_OF_CELL; /* FIXME: Implement a faster search algorithm */ - while((!found) && ((address<<2) < admap->last_byte)) { + while((!found) && (address < admap_entries)) { next_vobu = admap->vobu_start_sectors[address]; /* fprintf(MSG_OUT, "libdvdnav: Found block %u\n", next_vobu); */