aboutsummaryrefslogtreecommitdiff
path: root/drivers/oled/oled_driver.h
diff options
context:
space:
mode:
authorTed M Lin <tedmlin@gmail.com>2020-02-11 16:38:20 -0500
committerGitHub <noreply@github.com>2020-02-11 21:38:20 +0000
commit9456832a3bba4dd766a26a6286e78d3e88e4efce (patch)
treed5dfa046e2a8c08c9f8a8e597732f7764f453ee6 /drivers/oled/oled_driver.h
parent78e060f55adef8de358ba4bf7f5d5854a70dd421 (diff)
downloadqmk_firmware-9456832a3bba4dd766a26a6286e78d3e88e4efce.tar.gz
qmk_firmware-9456832a3bba4dd766a26a6286e78d3e88e4efce.zip
Fix out of bound OLED font access (#8145)
* Fix out of bound OLED font access The default font is 1344 bytes, or a total of 224 glyphs (each 6-bytes wide). OLED_FONT_END defaults to 224, which if used will then index off the end of the font array. So either the documentation or code is wrong. Instead of figuring out the rewording of the documentation, just change the OLED_FONT_END default value to 223, to match the documentation and code. * Add static assert to check array size Build bomb if the font array size doesn't match to the defines.
Diffstat (limited to 'drivers/oled/oled_driver.h')
-rw-r--r--drivers/oled/oled_driver.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index f490f367a..e8a718857 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -131,7 +131,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
131#endif 131#endif
132// unsigned char value of the last character in the font file 132// unsigned char value of the last character in the font file
133#if !defined(OLED_FONT_END) 133#if !defined(OLED_FONT_END)
134# define OLED_FONT_END 224 134# define OLED_FONT_END 223
135#endif 135#endif
136// Font render width 136// Font render width
137#if !defined(OLED_FONT_WIDTH) 137#if !defined(OLED_FONT_WIDTH)
@@ -260,4 +260,4 @@ bool oled_scroll_off(void);
260uint8_t oled_max_chars(void); 260uint8_t oled_max_chars(void);
261 261
262// Returns the maximum number of lines that will fit on the oled 262// Returns the maximum number of lines that will fit on the oled
263uint8_t oled_max_lines(void); \ No newline at end of file 263uint8_t oled_max_lines(void);