[edk2-devel] [PATCH V2] BaseTools: Resolve index out of range errors.

Mingyue Liang posted 1 patch 3 years, 5 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH V2] BaseTools: Resolve index out of range errors.
Posted by Mingyue Liang 3 years, 5 months ago
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 <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67517): https://edk2.groups.io/g/devel/message/67517
Mute This Topic: https://groups.io/mt/78225295/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V2] BaseTools: Resolve index out of range errors.
Posted by Bob Feng 3 years, 5 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Mingyue Liang <mingyuex.liang@intel.com> 
Sent: Friday, November 13, 2020 3:33 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: [PATCH V2] BaseTools: Resolve index out of range errors.

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 <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67660): https://edk2.groups.io/g/devel/message/67660
Mute This Topic: https://groups.io/mt/78225295/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH V2] BaseTools: Resolve index out of range errors.
Posted by Yuwei Chen 3 years, 5 months ago
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>

> -----Original Message-----
> From: Mingyue Liang <mingyuex.liang@intel.com>
> Sent: Friday, November 13, 2020 3:33 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
> Subject: [PATCH V2] BaseTools: Resolve index out of range errors.
> 
> 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 <mingyuex.liang@intel.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
> 
> 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67589): https://edk2.groups.io/g/devel/message/67589
Mute This Topic: https://groups.io/mt/78225295/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-