From 0f02da208c519c1cd0d3028a61ae6df2d5e7346c Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Tue, 31 Jan 2012 20:03:23 +0100 Subject: fuze+: check rectangle coordinates in lcd_update_rect Change-Id: I5f23063751d7650b8eefd0f37393498d9a27bd19 --- firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'firmware/target/arm/imx233/sansa-fuzeplus') diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index c84c29c22d..6ce3e3767f 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c @@ -501,6 +501,12 @@ void lcd_update_rect(int x, int y, int w, int h) if(!lcd_on) return; #endif + /* make sure the rectangle is included in the screen */ + x = MIN(x, LCD_WIDTH); + y = MIN(y, LCD_HEIGHT); + w = MIN(w, LCD_WIDTH - x); + h = MIN(h, LCD_HEIGHT - y); + imx233_lcdif_wait_ready(); lcd_write_reg(0x50, x); lcd_write_reg(0x51, x + w - 1); -- cgit v1.2.3