From patchwork Sat Oct 14 20:35:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/8] Require boundaries around local labels in handle_local_label X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 63940 Message-Id: <1508013322-19428-4-git-send-email-martin@martin.st> To: libav-devel@libav.org Date: Sat, 14 Oct 2017 23:35:18 +0300 From: Martin Storsjo List-Id: libav development 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. --- gas-preprocessor.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl index 09fcf0e..fe9c746 100755 --- a/gas-preprocessor.pl +++ b/gas-preprocessor.pl @@ -631,12 +631,12 @@ sub handle_local_label { my $dir = $_[2]; my $target = "$num$dir"; if ($dir eq "b") { - $line =~ s/$target/$last_temp_labels{$num}/g; + $line =~ s/\b$target\b/$last_temp_labels{$num}/g; } else { my $name = "temp_label_$temp_label_next"; $temp_label_next++; push(@{$next_temp_labels{$num}}, $name); - $line =~ s/$target/$name/g; + $line =~ s/\b$target\b/$name/g; } return $line; }