From c34003dcdd1cc0705c5464164f7d4dfd52d6d3d6 Mon Sep 17 00:00:00 2001 From: "dkl%redhat.com" <> Date: Thu, 19 Jun 2008 23:06:27 +0000 Subject: Bug 157092 – Implement a checking mechanism for invalid regexp Patch by David Lawrence - r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/DB/Mysql.pm | 8 ++++++-- Bugzilla/DB/Oracle.pm | 8 ++++++-- Bugzilla/DB/Pg.pm | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'Bugzilla/DB') diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 8bca06f4c..80f1cd793 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -104,13 +104,17 @@ sub bz_last_key { } sub sql_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "$expr REGEXP $pattern"; } sub sql_not_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "$expr NOT REGEXP $pattern"; } diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 9f759785e..1387a45cb 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -95,13 +95,17 @@ sub bz_last_key { } sub sql_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "REGEXP_LIKE($expr, $pattern)"; } sub sql_not_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "NOT REGEXP_LIKE($expr, $pattern)" } diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index 4777ba89a..a6a2e3281 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -93,13 +93,17 @@ sub bz_last_key { } sub sql_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "$expr ~* $pattern"; } sub sql_not_regexp { - my ($self, $expr, $pattern) = @_; + my ($self, $expr, $pattern, $nocheck) = @_; + + $self->bz_check_regexp($pattern) if !$nocheck; return "$expr !~* $pattern" } -- cgit v1.2.3-24-g4f1b