From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.243.1618940628165546857 for ; Tue, 20 Apr 2021 10:43:48 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: michael.d.kinney@intel.com) IronPort-SDR: nqmp+VE/2XyMGqJ3QVXswsXBUDbjKsNrMH4djt2/LO1A57tjtiIS4HL0Pp5eyuZUqg3YIUT3ju TovyRyGPZ5RQ== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="216175359" X-IronPort-AV: E=Sophos;i="5.82,237,1613462400"; d="scan'208";a="216175359" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 10:43:47 -0700 IronPort-SDR: 5b9Xxmha+Ye2/EJAPwhjmrc58MjMimPGaRJ3N0GSxu+wOQhGZK+aT8o3naQe526bZw+PvZ8+Y0 dN2B/d/PxZnA== X-IronPort-AV: E=Sophos;i="5.82,237,1613462400"; d="scan'208";a="427085083" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.212.244.69]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 10:43:46 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen Subject: [Patch 1/1] BaseTools/Source/Python: Verify TAB_TOD_DEFINES_FAMILY key present Date: Tue, 20 Apr 2021 10:43:40 -0700 Message-Id: <20210420174340.721-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3344 Veify that TAB_TOD_DEFINES_FAMILY key is present in ToolDef dictionary before access. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Michael D Kinney --- .../Source/Python/AutoGen/ModuleAutoGenHelper.py | 11 ++++++++--- BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py index 8e60643d1fd9..7477b1d77fb8 100644 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py @@ -1,7 +1,7 @@ ## @file # Create makefile for MS nmake and GNU make # -# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # from __future__ import absolute_import @@ -178,8 +178,11 @@ class AutoGenInfo(object): if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "": if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: continue - elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: - continue + else: + if ToolDef[Tool].get(TAB_TOD_DEFINES_FAMILY, "") == "": + continue + if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: + continue FamilyMatch = True # expand any wildcard if Target == TAB_STAR or Target == self.BuildTarget: @@ -213,6 +216,8 @@ class AutoGenInfo(object): if Tool not in ToolDef or Family == "": continue # option has been added before + if TAB_TOD_DEFINES_FAMILY not in ToolDef[Tool]: + continue if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: continue diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py index c16f2e4cd8b7..e2ef3256773e 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -1474,8 +1474,11 @@ class PlatformAutoGen(AutoGen): if ToolDef[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "": if Family != ToolDef[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]: continue - elif Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: - continue + else: + if ToolDef[Tool].get(TAB_TOD_DEFINES_FAMILY, "") == "": + continue + if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: + continue FamilyMatch = True # expand any wildcard if Target == TAB_STAR or Target == self.BuildTarget: @@ -1509,6 +1512,8 @@ class PlatformAutoGen(AutoGen): if Tool not in ToolDef or Family == "": continue # option has been added before + if TAB_TOD_DEFINES_FAMILY not in ToolDef[Tool]: + continue if Family != ToolDef[Tool][TAB_TOD_DEFINES_FAMILY]: continue -- 2.31.1.windows.1