Skip to content

Commit d0c3a3c

Browse files
committed
Require boundaries around local labels in handle_local_label
Since we're doing a replace of a string that looks like e.g "1b" over a full line, such a string could concievably be a substring of another identifier as well. This doesn't fix any known issue, but attempts to make this less fragile.
1 parent a2f6385 commit d0c3a3c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gas-preprocessor.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@ sub handle_local_label {
631631
my $dir = $_[2];
632632
my $target = "$num$dir";
633633
if ($dir eq "b") {
634-
$line =~ s/$target/$last_temp_labels{$num}/g;
634+
$line =~ s/\b$target\b/$last_temp_labels{$num}/g;
635635
} else {
636636
my $name = "temp_label_$temp_label_next";
637637
$temp_label_next++;
638638
push(@{$next_temp_labels{$num}}, $name);
639-
$line =~ s/$target/$name/g;
639+
$line =~ s/\b$target\b/$name/g;
640640
}
641641
return $line;
642642
}

0 commit comments

Comments
 (0)