From 2f45c3608eba388ad00d4e800d584d3c08f25f47 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 31 Aug 2013 20:36:08 +0200 Subject: [PATCH] Fix for stupid bug. --- misc/tools/progs-analyzer.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/misc/tools/progs-analyzer.pl b/misc/tools/progs-analyzer.pl index e8d7a212..d0df1c42 100755 --- a/misc/tools/progs-analyzer.pl +++ b/misc/tools/progs-analyzer.pl @@ -1227,12 +1227,12 @@ sub parse_progs($) my $file = $p{getstring}->($f->{s_file}); die "Out of range first_statement in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" if $f->{first_statement} >= @{$p{statements}}; - die "Out of range parm_start in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" - if $f->{parm_start} < 0 || $f->{parm_start} >= @{$p{globals}}; - die "Out of range locals in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" - if $f->{locals} < 0 || $f->{parm_start} + $f->{locals} >= @{$p{globals}}; if($f->{first_statement} >= 0) { + die "Out of range parm_start in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" + if $f->{parm_start} < 0 || $f->{parm_start} >= @{$p{globals}}; + die "Out of range locals in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" + if $f->{locals} < 0 || $f->{parm_start} + $f->{locals} > @{$p{globals}}; die "Out of range numparms $f->{numparms} in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" if $f->{numparms} < 0 || $f->{numparms} > 8; my $totalparms = 0; @@ -1243,7 +1243,9 @@ sub parse_progs($) $totalparms += $f->{parm_size}[$_]; } die "Out of range parms in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" - if $f->{locals} < 0 || $f->{parm_start} + $totalparms >= @{$p{globals}}; + if $f->{parm_start} + $totalparms > @{$p{globals}}; + die "More parms than locals in function $_ (name: \"$name\", file: \"$file\", first statement: $f->{first_statement})" + if $totalparms > $f->{locals}; } } -- 2.39.2