Do not allow RE2 to fallback to PCRE

This commit is contained in:
Pragmatic Software 2014-04-29 17:00:51 +00:00
parent 7fa458ab34
commit cebcafba70
3 changed files with 5 additions and 5 deletions

View File

@ -753,7 +753,7 @@ sub factchange {
} }
my $ret = eval { my $ret = eval {
use re::engine::RE2; use re::engine::RE2 -strict => 1;
if(not $factoids->{$channel}->{$trigger}->{action} =~ s|$tochange|$changeto|) { if(not $factoids->{$channel}->{$trigger}->{action} =~ s|$tochange|$changeto|) {
$self->{pbot}->logger->log("($from) $nick!$user\@$host: failed to change '$trigger' 's$delim$tochange$delim$changeto$delim\n"); $self->{pbot}->logger->log("($from) $nick!$user\@$host: failed to change '$trigger' 's$delim$tochange$delim$changeto$delim\n");
return "/msg $nick Change $trigger failed."; return "/msg $nick Change $trigger failed.";

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 558, BUILD_REVISION => 559,
BUILD_DATE => "2014-04-28", BUILD_DATE => "2014-04-29",
}; };
1; 1;

View File

@ -524,7 +524,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
} }
if($#replacements > -1) { if($#replacements > -1) {
use re::engine::RE2; use re::engine::RE2 -strict => 1;
@replacements = sort { $a->{'from'} cmp $b->{'from'} or $a->{'modifier'} <=> $b->{'modifier'} } @replacements; @replacements = sort { $a->{'from'} cmp $b->{'from'} or $a->{'modifier'} <=> $b->{'modifier'} } @replacements;
my ($previous_from, $previous_modifier); my ($previous_from, $previous_modifier);
@ -578,7 +578,7 @@ if($subcode =~ m/^\s*(?:and\s+)?(run|paste)\s*$/i) {
my $count = 0; my $count = 0;
my $unescaped = $from; my $unescaped = $from;
$unescaped =~ s/\\//g; $unescaped =~ s/\\//g;
if($code =~ s/($first_bound)$from($last_bound)/if(++$count == $modifier) { "$1$to$2"; } else { "$1$unescaped$2"; }/gex) { if($code =~ s/($first_bound)$from($last_bound)/if(++$count == $modifier) { "$1$to$2"; } else { "$1$unescaped$2"; }/ge) {
$got_change = 1; $got_change = 1;
} }
} }