dvd-sector-copy.c: Check `n' nonnegative before comparing with unsigned.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 18 Feb 2022 22:54:19 +0000 (22:54 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 18 Feb 2022 22:54:19 +0000 (22:54 +0000)
Otherwise it might be coerced to unsigned, at which point the comparison
means something completely different.

dvd-sector-copy.c

index c336d3d..177ce94 100644 (file)
@@ -595,7 +595,7 @@ static ssize_t recovery_read(struct recoverybuf *r,
     printf(" -> %zd\n", n);
 #endif
     if (n != nn) {
-      if (n > want) n = want;
+      if (n >= 0 && n > want) n = want;
       goto end;
     }
     r->start = pp;