mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Bastian Stender <bst@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Bastian Stender <bst@pengutronix.de>
Subject: [PATCH 3/3] 2d-primitives: check dimensions in __illuminate
Date: Thu, 23 Feb 2017 17:45:27 +0100	[thread overview]
Message-ID: <20170223164527.29878-3-bst@pengutronix.de> (raw)
In-Reply-To: <20170223164527.29878-1-bst@pengutronix.de>

gl_draw_circle draws outside of the screen if the resolution is too low.
This lead to memory corruption. Check the dimensions before drawing.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
---
 lib/gui/2d-primitives.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/gui/2d-primitives.c b/lib/gui/2d-primitives.c
index f3814eea44..0f29b32bab 100644
--- a/lib/gui/2d-primitives.c
+++ b/lib/gui/2d-primitives.c
@@ -13,6 +13,9 @@ static void __illuminate(struct fb_info *info,
 {
 	void *pixel;
 
+	if (x < 0 || y < 0 || x >= info->xres || y >= info->yres)
+		return;
+
 	pixel  = fb_get_screen_base(info);
 	pixel += y * info->line_length + x * (info->bits_per_pixel >> 3);
 
-- 
2.11.0


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

  parent reply	other threads:[~2017-02-23 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 16:45 [PATCH 1/3] graphic_utils: implement 8 bpp color depth in gu_set_pixel Bastian Stender
2017-02-23 16:45 ` [PATCH 2/3] graphic_utils: do not allocate info in fb_open Bastian Stender
2017-02-23 16:45 ` Bastian Stender [this message]
2017-02-24  7:24 ` [PATCH 1/3] graphic_utils: implement 8 bpp color depth in gu_set_pixel Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170223164527.29878-3-bst@pengutronix.de \
    --to=bst@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox