From d935b4815a7e314cfe75f46ad6eb9bfb6f5f447b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 18 Feb 2022 22:54:19 +0000 Subject: [PATCH] dvd-sector-copy.c: Check `n' nonnegative before comparing with unsigned. Otherwise it might be coerced to unsigned, at which point the comparison means something completely different. --- dvd-sector-copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvd-sector-copy.c b/dvd-sector-copy.c index c336d3d..177ce94 100644 --- a/dvd-sector-copy.c +++ b/dvd-sector-copy.c @@ -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; -- 2.11.0