From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.1211.1605252791949364648 for ; Thu, 12 Nov 2020 23:33:12 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: mingyuex.liang@intel.com) IronPort-SDR: TdQZReQJyLqKm3n2AY2ItWgtY7s7/IqxQerACSPjVn1MXkROjvnfstQ9ieoYv9RWHiJOYcUMgD 3lXfNsQ2hnIQ== X-IronPort-AV: E=McAfee;i="6000,8403,9803"; a="167858008" X-IronPort-AV: E=Sophos;i="5.77,474,1596524400"; d="scan'208";a="167858008" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 23:33:09 -0800 IronPort-SDR: m25QvBshKV6DlNHybk8qnJxRPZB5ke9mx17KBMgdoEM/fXxZSINZp7Wt12miw9UuLBBjUjOo15 mrYs475mTuJQ== X-IronPort-AV: E=Sophos;i="5.77,474,1596524400"; d="scan'208";a="542571515" Received: from bob-desktop.ccr.corp.intel.com ([10.239.49.71]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 23:33:07 -0800 From: "Mingyue Liang" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen Subject: [PATCH V2] BaseTools: Resolve index out of range errors. Date: Fri, 13 Nov 2020 15:33:01 +0800 Message-Id: <20201113073301.1028-1-mingyuex.liang@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This problem is generated by solving bz2972's patch, and the commit ID is 0af7f8e6a9253960ba820cd6ddfd8c36543d30cb. This is a problem when updating the DEPs file. The code does not consider that there is only one line of content in the file, so the filter condition is added to prevent the index from exceeding the range. Signed-off-by: Mingyue Liang Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- V2: Change the title to make it clearer and more descriptive. BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py index b06ef42573fd..5ec26eb98b42 100644 --- a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py @@ -291,7 +291,8 @@ ${END} targetitem = self.GetRealTarget(source_abs.strip(" :")) targetitem += ": " - targetitem += lines[1] + if len(lines)>=2: + targetitem += lines[1] newcontent.append(targetitem) newcontent.extend(lines[2:]) newcontent.append("\n") -- 2.29.2.windows.2