[DVDnav-discuss] r946 - trunk/libdvdnav2/src/searching.c

nicodvb subversion at mplayerhq.hu
Thu Jul 12 22:10:32 CEST 2007


Author: nicodvb
Date: Thu Jul 12 22:10:32 2007
New Revision: 946

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

Modified:
   trunk/libdvdnav2/src/searching.c

Modified: trunk/libdvdnav2/src/searching.c
==============================================================================
--- trunk/libdvdnav2/src/searching.c	(original)
+++ trunk/libdvdnav2/src/searching.c	Thu Jul 12 22:10:32 2007
@@ -66,11 +66,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