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.65; helo=mga03.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 2200C2096FAB9 for ; Mon, 25 Jun 2018 00:36:43 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2018 00:36:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,269,1526367600"; d="scan'208";a="50306497" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.4]) by fmsmga008.fm.intel.com with ESMTP; 25 Jun 2018 00:36:42 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng , Michael D Kinney Date: Mon, 25 Jun 2018 15:36:58 +0800 Message-Id: <20180625073658.212076-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: <20180625073658.212076-1-ruiyu.ni@intel.com> References: <20180625073658.212076-1-ruiyu.ni@intel.com> Subject: [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, 25 Jun 2018 07:36:43 -0000 The patch adds check logic to make sure that for a input BMP file, the width or height is not 0; for a input GOP blt buffer, the width or height is not 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/MdeModulePkg/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; } + if ((BmpHeader->PixelHeight == 0) || (BmpHeader->PixelWidth == 0)) { + DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight or BmpHeader->PixelWidth is 0.\n")); + return RETURN_UNSUPPORTED; + } + // // Only support BITMAPINFOHEADER format. // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER @@ -484,6 +489,10 @@ TranslateGopBltToBmp ( return RETURN_INVALID_PARAMETER; } + if ((PixelHeight == 0) || (PixelWidth == 0)) { + return RETURN_UNSUPPORTED; + } + // // Allocate memory for BMP file. // -- 2.16.1.windows.1