1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-26 08:29:33 +00:00

Ensure character pixel reads can't go out of bounds.

This commit is contained in:
Thomas Harte 2021-06-24 22:19:50 -04:00
parent d1b89392a2
commit c34a548fa0

View File

@ -562,10 +562,10 @@ template <int bpp, int index_bits> void Nick::output_character(uint16_t *target,
const uint8_t character = ram_[line_data_pointer_[0]];
++line_data_pointer_[0];
const uint8_t pixels = ram_[
const uint8_t pixels = ram_[(
(line_data_pointer_[1] << index_bits) +
(character & ((1 << index_bits) - 1))
];
) & 0xffff];
// TODO: below looks repetitious of the above, but I've yet to factor in
// ALTINDs and [M/L]SBALTs, so I'll correct for factoring when I've done that.