chiark / gitweb /
dvd-sector-copy.c: Reinterpret the `step' as being beyond the high bound.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 6 Mar 2022 00:58:20 +0000 (00:58 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 6 Mar 2022 00:58:20 +0000 (00:58 +0000)
dvd-sector-copy.c

index f757e496a9a13fcebcde0afebb8c02464f18d52e..bed3cf62d1f4716f35f72ddf871a808613dc6928 100644 (file)
@@ -736,11 +736,11 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
       recovered(bad_lo, end); *pos_inout = end;
       return (0);
     }
-    step = step_factor*(bad_hi - bad_lo);
+    step = (step_factor - 1)*(bad_hi - bad_lo);
     if (step < step_min) step = step_min;
     if (step_max && step > step_max) step = step_max;
-    if (step > end - bad_lo) step = end - bad_lo;
-    pos = bad_lo + step - 1;
+    if (step > end - bad_hi) step = end - bad_hi;
+    pos = bad_hi + step - 1;
     want = run_length_wanted(pos, step, end);
     n = recovery_read(&r, pos, want);
 #ifdef DEBUG