Bitmap: Fix crash by attempting to memset -1 bits (UINT64_MAX)

This commit is contained in:
apio 2022-12-07 14:46:11 +01:00 committed by Gitea
parent d3458f2f0f
commit f65ed465c4

View File

@ -65,10 +65,11 @@ void Bitmap::clear_region(usize start, usize bits, bool value)
if (!bits) return; if (!bits) return;
// Set individual bits while not on a byte boundary. // Set individual bits while not on a byte boundary.
while ((start % 8) && bits--) while ((start % 8) && bits)
{ {
set(start, value); set(start, value);
start++; start++;
bits--;
} }
// Clear out the rest in bytes. // Clear out the rest in bytes.