diff options
author | mkanat%bugzilla.org <> | 2008-06-23 16:54:45 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-06-23 16:54:45 +0200 |
commit | 4d9a13264e6ea5e6ba0fb6bcac93b7633814bed9 (patch) | |
tree | b42d2157c46b24635d294f04092a25032d15ca7d | |
parent | 50be238662cdeb47f0b74c060c4c336822844bdb (diff) | |
download | bugzilla-4d9a13264e6ea5e6ba0fb6bcac93b7633814bed9.tar.gz bugzilla-4d9a13264e6ea5e6ba0fb6bcac93b7633814bed9.tar.xz |
Bug 157092: Implement a checking mechanism for invalid regexp (Fix the Oracle driver)
Patch By Xiaoou Wu <xiaoou.wu@oracle.com> r=mkanat, a=mkanat
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 1387a45cb..19ebbb2c5 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -94,6 +94,16 @@ sub bz_last_key { return $last_insert_id; } +sub bz_check_regexp { + my ($self, $pattern) = @_; + + eval { $self->do("SELECT 1 FROM DUAL WHERE " + . $self->sql_regexp($self->quote("a"), $self->quote($pattern), 1)) }; + + $@ && ThrowUserError('illegal_regexp', + { value => $pattern, dberror => $self->errstr }); +} + sub sql_regexp { my ($self, $expr, $pattern, $nocheck) = @_; |