From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0E9CE202E5462 for ; Mon, 2 Jul 2018 03:05:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 03:05:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,298,1526367600"; d="scan'208";a="54468262" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 02 Jul 2018 03:05:33 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 03:05:28 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 03:05:27 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Mon, 2 Jul 2018 18:05:25 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Zeng, Star" Thread-Topic: [PATCH 2/2] MdeModulePkg/BmpSupportLib: Check PixelHeight/PixelWidth against 0 Thread-Index: AQHUDFdJH6xuWIV7ZEyTESdTXzCZM6R7v1tQ Date: Mon, 2 Jul 2018 10:05:25 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB609B4@shsmsx102.ccr.corp.intel.com> References: <20180625073658.212076-1-ruiyu.ni@intel.com> <20180625073658.212076-3-ruiyu.ni@intel.com> In-Reply-To: <20180625073658.212076-3-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/2] MdeModulePkg/BmpSupportLib: Check PixelHeight/PixelWidth against 0 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 10:05:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please add reference to bugzilla link into the commit log. https://bugzilla.tianocore.org/show_bug.cgi?id=3D944 Another, is there any reason to only add debug message for " if ((BmpHeader= ->PixelHeight =3D=3D 0) || (BmpHeader->PixelWidth =3D=3D 0)) { ", but not "= if ((PixelHeight =3D=3D 0) || (PixelWidth =3D=3D 0)) { " ??? Thanks, Star -----Original Message----- From: Ni, Ruiyu=20 Sent: Monday, June 25, 2018 3:37 PM To: edk2-devel@lists.01.org Cc: Zeng, Star ; Kinney, Michael D Subject: [PATCH 2/2] MdeModulePkg/BmpSupportLib: Check PixelHeight/PixelWid= th against 0 The patch adds check logic to make sure that for a input BMP file, the widt= h or height is not 0; for a input GOP blt buffer, the width or height is no= t 0. Otherwise, UNSUPPORTED status is returned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Michael D Kinney --- MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeMo= dulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c index 2c23e2c61c..6196262d14 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -148,6 +148,11 @@ TranslateBmpToGopBlt ( return RETURN_UNSUPPORTED; } =20 + if ((BmpHeader->PixelHeight =3D=3D 0) || (BmpHeader->PixelWidth =3D=3D 0= )) { + DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight or = BmpHeader->PixelWidth is 0.\n")); + return RETURN_UNSUPPORTED; + } + // // Only support BITMAPINFOHEADER format. // BITMAPFILEHEADER + BITMAPINFOHEADER =3D BMP_IMAGE_HEADER @@ -484,6 +4= 89,10 @@ TranslateGopBltToBmp ( return RETURN_INVALID_PARAMETER; } =20 + if ((PixelHeight =3D=3D 0) || (PixelWidth =3D=3D 0)) { + return RETURN_UNSUPPORTED; + } + // // Allocate memory for BMP file. // -- 2.16.1.windows.1