this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

window(fill) bounds check for start and end positions in both conditions

authored by

00JCIV00 and committed by
Tim Culverhouse
ca6a67f6 999b0f4f

+4 -3
+4 -3
src/Window.zig
··· 217 217 return; 218 218 if (self.x_off == 0 and self.width == self.screen.width) { 219 219 // we have a full width window, therefore contiguous memory. 220 - const start = self.y_off * self.width; 220 + const start = @min(self.y_off * self.width, self.screen.buf.len); 221 221 const end = @min(start + (self.height * self.width), self.screen.buf.len); 222 222 @memset(self.screen.buf[start..end], cell); 223 223 } else { ··· 225 225 var row: usize = self.y_off; 226 226 const last_row = @min(self.height + self.y_off, self.screen.height); 227 227 while (row < last_row) : (row += 1) { 228 - const start = self.x_off + (row * self.screen.width); 229 - const end = @min(start + self.width, start + (self.screen.width - self.x_off)); 228 + const start = @min(self.x_off + (row * self.screen.width), self.screen.buf.len); 229 + var end = @min(start + self.width, start + (self.screen.width - self.x_off)); 230 + end = @min(end, self.screen.buf.len); 230 231 @memset(self.screen.buf[start..end], cell); 231 232 } 232 233 }