From fd32a1a35d928726c4f9c06d1c573825672a29d6 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Fri, 3 Jan 2014 00:02:27 +0100 Subject: Bug 543432: [PostgreSQL] Crash when typing a string in combination with a numeric field r=dkl a=sgreen --- Bugzilla/Search.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index e546be6d9..2d1f3af11 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1997,11 +1997,18 @@ sub _quote_unless_numeric { my $numeric_field = $self->_chart_fields->{$field}->is_numeric; my $numeric_value = ($value =~ NUMBER_REGEX) ? 1 : 0; my $is_numeric = $numeric_operator && $numeric_field && $numeric_value; + + # These operators are really numeric operators with numeric fields. + $numeric_operator = grep { $_ eq $operator } keys SIMPLE_OPERATORS; + if ($is_numeric) { my $quoted = $value; trick_taint($quoted); return $quoted; } + elsif ($numeric_field && !$numeric_value && $numeric_operator) { + ThrowUserError('number_not_numeric', { field => $field, num => $value }); + } return Bugzilla->dbh->quote($value); } -- cgit v1.2.3-24-g4f1b