[U-Boot] [PATCH v5 01/15] video: bmp: check resolutions of panel/bitmap
Yannick Fertré
yannick.fertre at st.com
Mon Oct 7 13:29:01 UTC 2019
If the size of the bitmap is 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é <yannick.fertre at st.com>
---
drivers/video/video_bmp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 193f37d..4af1fb4 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -249,6 +249,13 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
+ /* check if picture size exceeds panel size */
+ if ((pwidth < width) || (priv->ysize < height)) {
+ printf("Error: BMP size %d x %d is bigger than panel size %d x %d\n",
+ (int)width, (int)height, priv->xsize, priv->ysize);
+ return -EINVAL;
+ }
+
if (align) {
video_splash_align_axis(&x, priv->xsize, width);
video_splash_align_axis(&y, priv->ysize, height);
--
2.7.4
More information about the U-Boot
mailing list