Fix underflow errors in VGA driver (#603)

This commit is contained in:
Vincent Ollivier 2024-03-22 11:13:26 +01:00 committed by GitHub
parent f6b8946b37
commit 3895f4618c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -343,7 +343,7 @@ impl Perform for Writer {
for param in params.iter() {
x = param[0] as usize; // 1-indexed value
}
if x > BUFFER_WIDTH {
if x == 0 || x > BUFFER_WIDTH {
return;
}
self.set_writer_position(x - 1, y);
@ -359,7 +359,7 @@ impl Perform for Writer {
_ => break,
};
}
if x > BUFFER_WIDTH || y > BUFFER_HEIGHT {
if x == 0 || y == 0 || x > BUFFER_WIDTH || y > BUFFER_HEIGHT {
return;
}
self.set_writer_position(x - 1, y - 1);