author | Jianxiong Pan <jianxiong.pan@amlogic.com> | 2019-07-30 01:57:56 (GMT) |
---|---|---|
committer | Lawrence Mok <lawrence.mok@amlogic.com> | 2019-07-30 02:34:21 (GMT) |
commit | 4b47fce393eaa05cc401ac5b19ca4e349c6b3bf2 (patch) | |
tree | 6a1c3b778eb7bed611f454e5d41b5f3ca2cbbae4 | |
parent | 602b5bf65b424a12a4400a9dd7f104cf282c4718 (diff) | |
download | common-4b47fce393eaa05cc401ac5b19ca4e349c6b3bf2.zip common-4b47fce393eaa05cc401ac5b19ca4e349c6b3bf2.tar.gz common-4b47fce393eaa05cc401ac5b19ca4e349c6b3bf2.tar.bz2 |
scripts: fixed an issue that could cause an infinite loop. [1/1]
PD#SWPL-12025
Problem:
the merge_pre_check.pl script has an bug that may enter an infinite loop,
causing problems.
Solution:
add the length of the detection conditions.
Verify:
local test.
Change-Id: I48fe839678ea0884a9082197eab083a2b8f489cd
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
-rwxr-xr-x | scripts/amlogic/merge_pre_check.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/amlogic/merge_pre_check.pl b/scripts/amlogic/merge_pre_check.pl index 73ce86a..515d515 100755 --- a/scripts/amlogic/merge_pre_check.pl +++ b/scripts/amlogic/merge_pre_check.pl @@ -171,7 +171,7 @@ sub check_msg_49_2 } $i += 1; - while( $str[$i] !~ /^Solution:[\n].+/ && $str[$i] !~ /^Change-Id:/ && $str[$i] !~ /^Verify:[\n].+/ ) + while( $str[$i] !~ /^Solution:[\n].+/ && $str[$i] !~ /^Change-Id:/ && $str[$i] !~ /^Verify:[\n].+/ && ($i + 1) < $len) { $i = $i + 1; } @@ -189,7 +189,7 @@ sub check_msg_49_2 return -1; } - while( $str[$i] !~ /^Verify:[\n].+/ && $str[$i] !~ /^Change-Id:/ ) + while( $str[$i] !~ /^Verify:[\n].+/ && $str[$i] !~ /^Change-Id:/ && ($i + 1) < $len ) { $i += 1; } |