mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 10:30:14 +01:00
fix out of bounds read
This commit is contained in:
parent
9ea79a370f
commit
43b096bd69
|
@ -10,7 +10,7 @@ use servicepoint::{Grid, PixelGrid, TILE_SIZE};
|
||||||
const DEFAULT_FONT_FILE: &[u8] = include_bytes!("../Web437_IBM_BIOS.woff");
|
const DEFAULT_FONT_FILE: &[u8] = include_bytes!("../Web437_IBM_BIOS.woff");
|
||||||
|
|
||||||
pub struct BitmapFont {
|
pub struct BitmapFont {
|
||||||
bitmaps: [PixelGrid; u8::MAX as usize],
|
bitmaps: [PixelGrid; u8::MAX as usize + 1],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BitmapFont {
|
impl BitmapFont {
|
||||||
|
@ -18,7 +18,7 @@ impl BitmapFont {
|
||||||
let mut bitmaps =
|
let mut bitmaps =
|
||||||
core::array::from_fn(|_| PixelGrid::new(TILE_SIZE, TILE_SIZE));
|
core::array::from_fn(|_| PixelGrid::new(TILE_SIZE, TILE_SIZE));
|
||||||
|
|
||||||
for char_code in u8::MIN..u8::MAX {
|
for char_code in u8::MIN..=u8::MAX {
|
||||||
let char = char_code as char;
|
let char = char_code as char;
|
||||||
let glyph_id = match font.glyph_for_char(char) {
|
let glyph_id = match font.glyph_for_char(char) {
|
||||||
None => continue,
|
None => continue,
|
||||||
|
|
Loading…
Reference in a new issue