[PATCH 3/3] 2d-primitives: check dimensions in __illuminate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux