notaz.gp2x.de
/
libpicofe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21604a0
)
Prevent segfault in draw_key_config (#2)
author
Nolan "Tempa Kyouran" Varani
<landesherr@users.noreply.github.com>
Sat, 30 Sep 2017 12:17:30 +0000
(07:17 -0500)
committer
notaz
<notasas@gmail.com>
Sat, 30 Sep 2017 12:17:30 +0000
(15:17 +0300)
Its calculated `y` value can dip below zero
This causes a segfault if used as an argument of `text_out16`
menu.c
patch
|
blob
|
blame
|
history
diff --git
a/menu.c
b/menu.c
index
b40a5df
..
f1b1957
100644
(file)
--- a/
menu.c
+++ b/
menu.c
@@
-1381,7
+1381,8
@@
static void draw_key_config(const me_bind_action *opts, int opt_cnt, int player_
y = (g_menuscreen_h - 4 * me_mfont_h) / 2 - (2 + opt_cnt) * me_mfont_h / 2;
\r
if (x < me_mfont_w * 2)
\r
x = me_mfont_w * 2;
\r
-
\r
+ if (y < 0)
\r
+ y = 0;
\r
menu_draw_begin(1, 0);
\r
if (player_idx >= 0)
\r
text_out16(x, y, "Player %i controls", player_idx + 1);
\r