From 46e23c8e58a6235e641b36d021026e85ae190d32 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 12 Nov 2021 16:24:32 -0800 Subject: [PATCH] put a reasonable limit of 100 on weld cutoff level --- lib/Perl/Tidy/Formatter.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 793e2b99..242b81f3 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -1846,7 +1846,12 @@ EOM # Cases b1197-b1204 work ok with const=12 but not with const=8 my $const = 16; $stress_level = 0; - foreach my $level ( 0 .. $level_max ) { + + # Put a reasonable limit on stress level (say 100) in case the + # whitespace-cycle variable is used. + my $stress_level_limit = min( 100, $level_max ); + + foreach my $level ( 0 .. $stress_level_limit ) { my $remaining_cycles = max( 0, ( -- 2.39.5