From patchwork Wed Nov 20 13:11:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 1198130 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="m9q41DOQ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47J35P72fbz9sPW for ; Thu, 21 Nov 2019 00:12:41 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A0B32C21FBD; Wed, 20 Nov 2019 13:11:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 74018C21F3E; Wed, 20 Nov 2019 13:11:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A32C7C21C6A; Wed, 20 Nov 2019 13:11:24 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id D2757C21EE8 for ; Wed, 20 Nov 2019 13:11:22 +0000 (UTC) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAKD7Kh3024914; Wed, 20 Nov 2019 14:11:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=STMicroelectronics; bh=bPcKLrGrjkOngYrBlTg77N8oIFVSE9OMtsdm++7UKlY=; b=m9q41DOQeI2IKmThF+xZZ+ZPmrzHfwB8yZ5oNQwrtaw/n5FD1KKCNorUDJgEJMroEhy2 da0v9LL7zWtcB3nOCmseI+3DCFAEOLCa7nDaIq/xzx1z7RBsRMQpCBN+Ds8rHujvXkDg Yw4C1OtlAmuNp3zRJaEsC9AmqPn27VFIlnFyjuKxG8ardpkymbXQCRHPECoV+aaG6F01 B9mFuf08hU5lTvz7lmkoMPEffJQ4ceaCx7d015Mp/by5eYuqQUaE2lxOpV/dnK3bC72k j98JNvJIDX9km45uE1pCKwP4P/Arh77Kn10TR21RxqTF8WpwyZnbG2DYKyoP6YNKR0rp fg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2wa9uj5thr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Nov 2019 14:11:21 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BAF0D10002A; Wed, 20 Nov 2019 14:11:20 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B1C602FF5C5; Wed, 20 Nov 2019 14:11:20 +0100 (CET) Received: from localhost (10.75.127.50) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 20 Nov 2019 14:11:20 +0100 From: Patrice Chotard To: Date: Wed, 20 Nov 2019 14:11:16 +0100 Message-ID: <20191120131116.20620-3-patrice.chotard@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191120131116.20620-1-patrice.chotard@st.com> References: <20191120131116.20620-1-patrice.chotard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG7NODE2.st.com (10.75.127.20) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-20_03:2019-11-15, 2019-11-20 signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH v2 2/2] video: bmp: Fix video_display_rle8_bitmap() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 CC: Yannick Fertré --- Changes in v2: None drivers/video/video_bmp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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