mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] fbconsole: check cursor position before moving
@ 2017-02-23 17:20 Bastian Stender
  2017-02-23 17:20 ` [PATCH 2/2] fbconsole: implement vt100 cursor shown/hidden Bastian Stender
  2017-02-24  7:32 ` [PATCH 1/2] fbconsole: check cursor position before moving Sascha Hauer
  0 siblings, 2 replies; 11+ messages in thread
From: Bastian Stender @ 2017-02-23 17:20 UTC (permalink / raw)
  To: barebox; +Cc: Bastian Stender

Moving the cursor to x=2, y=2 with "\e[3;3H" on a 12x2 framebuffer
console lead to a barebox crash while drawing the cursor. The cursor can
only be moved to a valid position between (0,0) and (priv->cols,
priv->rows) now.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
---
 drivers/video/fbconsole.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 64f7d7364e..3879741b2a 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -264,10 +264,13 @@ static void fbc_parse_csi(struct fbc_priv *priv)
 		return;
 	case 'H':
 		video_invertchar(priv, priv->x, priv->y);
+
 		pos = simple_strtoul(priv->csi, &end, 10);
-		priv->y = pos ? pos - 1 : 0;
+		priv->y = (pos && pos <= priv->rows + 1) ? pos - 1 : 0;
+
 		pos = simple_strtoul(end + 1, NULL, 10);
-		priv->x = pos ? pos - 1 : 0;
+		priv->x = (pos && pos <= priv->cols + 1) ? pos - 1 : 0;
+
 		video_invertchar(priv, priv->x, priv->y);
 	case 'K':
 		pos = simple_strtoul(priv->csi, &end, 10);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-02-28  6:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 17:20 [PATCH 1/2] fbconsole: check cursor position before moving Bastian Stender
2017-02-23 17:20 ` [PATCH 2/2] fbconsole: implement vt100 cursor shown/hidden Bastian Stender
2017-02-24  7:32 ` [PATCH 1/2] fbconsole: check cursor position before moving Sascha Hauer
2017-02-24 11:18   ` Ian Abbott
2017-02-24 13:22     ` Bastian Stender
2017-02-24 13:36       ` [PATCH v2] " Bastian Stender
2017-02-27  7:57         ` Sascha Hauer
2017-02-27 13:39           ` [PATCH v3] " Bastian Stender
2017-02-27 18:46             ` Ian Abbott
2017-02-27 18:51               ` Ian Abbott
2017-02-28  6:46             ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox