diff mbox series

[U-Boot,v2,2/2] video: bmp: Fix video_display_rle8_bitmap()

Message ID 20191120131116.20620-3-patrice.chotard@st.com
State Accepted
Commit ca2c6945b9e158716138b9d138c72676e719bd8e
Delegated to: Anatolij Gustschin
Headers show
Series Fix BMP decode when BMP size is bigger than framebuffer | expand

Commit Message

Patrice CHOTARD Nov. 20, 2019, 1:11 p.m. UTC
In case the BMP size is bigger than the frame buffer, don't use
the BMP's width and height in video_display_rle8_bitmap, but the
one's checked in video_bmp_display() as parameters to
video_display_rle8_bitmap().

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
CC: Yannick Fertré <yannick.fertre@st.com>


---

Changes in v2: None

 drivers/video/video_bmp.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Anatolij Gustschin Dec. 10, 2019, 10:22 a.m. UTC | #1
On Wed, 20 Nov 2019 14:11:16 +0100
Patrice Chotard patrice.chotard@st.com wrote:
... 
> Changes in v2: None
> 
>  drivers/video/video_bmp.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij
diff mbox series

Patch

diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 92847a8088..0e7b6b20ad 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -40,18 +40,16 @@  static void draw_encoded_bitmap(ushort **fbp, ushort col, int cnt)
 
 static void video_display_rle8_bitmap(struct udevice *dev,
 				      struct bmp_image *bmp, ushort *cmap,
-				      uchar *fb, int x_off, int y_off)
+				      uchar *fb, int x_off, int y_off,
+				      ulong width, ulong height)
 {
 	struct video_priv *priv = dev_get_uclass_priv(dev);
 	uchar *bmap;
-	ulong width, height;
 	ulong cnt, runlen;
 	int x, y;
 	int decode = 1;
 
 	debug("%s\n", __func__);
-	width = get_unaligned_le32(&bmp->header.width);
-	height = get_unaligned_le32(&bmp->header.height);
 	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
 	x = 0;
@@ -277,7 +275,7 @@  int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 				return -EPROTONOSUPPORT;
 			}
 			video_display_rle8_bitmap(dev, bmp, cmap_base, fb, x,
-						  y);
+						  y, width, height);
 			break;
 		}
 #endif