summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastian Stender <bst@pengutronix.de>2017-02-23 17:45:27 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-24 08:24:35 +0100
commitab5a26ef141020dc386c91ce324f8a3ac9408c76 (patch)
tree74478388848e8d45d5d4ecc16eab8a41cefc7d64
parent43f2decf5be47595036994672b2c9cc84fab86ee (diff)
downloadbarebox-ab5a26ef141020dc386c91ce324f8a3ac9408c76.tar.gz
barebox-ab5a26ef141020dc386c91ce324f8a3ac9408c76.tar.xz
2d-primitives: check dimensions in __illuminate
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--lib/gui/2d-primitives.c3
1 files changed, 3 insertions, 0 deletions
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);