changeset 303:52cda7471a24 src

fixed off-by-one bug in scan_admap (copied reference code from ifo_print.c); reported by ggurov+abv-bg
author nicodvb
date Thu, 12 Jul 2007 20:09:45 +0000
parents ef017423e37c
children 0110b591bf9c
files searching.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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); */