[DVDnav-discuss] r945 - trunk/libdvdnav/src/searching.c

nicodvb subversion at mplayerhq.hu
Thu Jul 12 22:09:45 CEST 2007


Author: nicodvb
Date: Thu Jul 12 22:09:45 2007
New Revision: 945

Log:
fixed off-by-one bug in scan_admap (copied reference code from ifo_print.c); reported by ggurov+abv-bg

Modified:
   trunk/libdvdnav/src/searching.c

Modified: trunk/libdvdnav/src/searching.c
==============================================================================
--- trunk/libdvdnav/src/searching.c	(original)
+++ trunk/libdvdnav/src/searching.c	Thu Jul 12 22:09:45 2007
@@ -79,11 +79,12 @@ static dvdnav_status_t dvdnav_scan_admap
     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); */



More information about the DVDnav-discuss mailing list