cvsuser 02/06/13 17:22:55
Modified: . assemble.pl
Log:
Added check for register out-of-bounds.
Revision Changes Path
1.71 +15 -0 parrot/assemble.pl
Index: assemble.pl
===================================================================
RCS file: /cvs/public/parrot/assemble.pl,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -w -r1.70 -r1.71
--- assemble.pl 12 Jun 2002 15:01:50 -0000 1.70
+++ assemble.pl 14 Jun 2002 00:22:55 -0000 1.71
@@ -704,6 +704,11 @@
# Skip flying comments.
}
elsif($temp=~s/^($reg_re)//) {
+ my $reg_idx = substr($1,1);
+ unless($reg_idx >= 0 and $reg_idx <= 31) {
+ print STDERR "Caught out-of-bounds register $1 at line $_->[1].\n";
+ last;
+ }
$suffixes .= "_".lc(substr($1,0,1));
push @{$_->[0]}, [lc(substr($1,0,1)),$1];
}
@@ -718,10 +723,20 @@
# XXX of the string, so we can nip off another argument.
#
elsif($temp=~s/^\[k;($reg_re)/\[k/) {
+ my $reg_idx = substr(1,$1);
+ unless($reg_idx >= 0 and $reg_idx <= 31) {
+ print STDERR "Caught out-of-bounds register $1 at line $_->[1].\n";
+ last;
+ }
$suffixes .= "_k";
push @{$_->[0]}, ['k',$1];
}
elsif($temp=~s/^\[(S\d+)\]//) { # The only key register should be Sn
+ my $reg_idx = substr(1,$1);
+ unless($reg_idx >= 0 and $reg_idx <= 31) {
+ print STDERR "Caught out-of-bounds register $1 at line $_->[1].\n";
+ last;
+ }
$suffixes .= "_s";
push @{$_->[0]}, ['s',$1];
}