summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorkiko%async.com.br <>2004-07-23 02:48:37 +0200
committerkiko%async.com.br <>2004-07-23 02:48:37 +0200
commit28fa2f54b2c400ff2067a7e76f1af5f7d361908b (patch)
treed3994ba52e8825d2bd5756734335977f0ef50f90 /Bugzilla
parenteffe8d6362e02436673ae80c019a13769dd424cb (diff)
downloadbugzilla-28fa2f54b2c400ff2067a7e76f1af5f7d361908b.tar.gz
bugzilla-28fa2f54b2c400ff2067a7e76f1af5f7d361908b.tar.xz
Fix for bug 252159: centralize time validation. Adds a ValidateTime
function to Bugzilla::Bug and uses it in relevant callsites. Patch by Alexandre Michetti Manduca <michetti@grad.icmc.usp.br>. r=kiko, a=justdave.
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index f1a1cf341..a09e7a906 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -42,6 +42,7 @@ use Bugzilla::Flag;
use Bugzilla::FlagType;
use Bugzilla::User;
use Bugzilla::Util;
+use Bugzilla::Error;
sub fields {
# Keep this ordering in sync with bugzilla.dtd
@@ -489,6 +490,13 @@ sub EmitDependList {
return @list;
}
+sub ValidateTime{
+ my ($time, $field) = @_;
+ if ($time > 99999.99 || $time < 0 || !($time =~ /^(?:\d+(?:\.\d*)?|\.\d+)$/)){
+ ThrowUserError("need_positive_number", {field => "$field"}, 1);
+ }
+ }
+
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $attr = $AUTOLOAD;