From: =?UTF-8?q?Yannick=20Fertr=C3=A9?= Date: Fri, 25 Oct 2019 11:21:49 +0200 Subject: [U-Boot] [PATCH] video: bmp: check coordinates of bitmap Message-ID: <1571995309-8069-1-git-send-email-yannick.fertre@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de If the coordinates are bigger than the size of the panel then errors appear when calculating axis alignment and the copy of bitmap is done outside of framebuffer. Signed-off-by: Yannick Fertr=C3=A9 --- drivers/video/video_bmp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 4af1fb4..74267f7 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -256,6 +256,19 @@ int video_bmp_display(struct udevice *dev, ulong bmp_i= mage, int x, int y, return -EINVAL; } =20 + /* check if coordinates exceeds panel size */ + if (pwidth < x && x !=3D BMP_ALIGN_CENTER) { + printf("Error: Coordinate x %d is bigger than panel width %d\n", + (int)x, (int)pwidth); + return -EINVAL; + } + + if (priv->ysize < y && y !=3D BMP_ALIGN_CENTER) { + printf("Error: Coordinate y %d is bigger than panel height %d\n" + , (int)y, (int)priv->ysize); + return -EINVAL; + } + if (align) { video_splash_align_axis(&x, priv->xsize, width); video_splash_align_axis(&y, priv->ysize, height); --=20 2.7.4