From 4b47fce393eaa05cc401ac5b19ca4e349c6b3bf2 Mon Sep 17 00:00:00 2001 From: Jianxiong Pan Date: Tue, 30 Jul 2019 09:57:56 +0800 Subject: [PATCH] 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 --- scripts/amlogic/merge_pre_check.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/amlogic/merge_pre_check.pl b/scripts/amlogic/merge_pre_check.pl index 73ce86a1f00e..515d5155bfe9 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; }