summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-10 23:08:29 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-10 23:08:29 +0000
commitca36c789c4284f53f61e6c308c6928f8bdc51bb4 (patch)
treeaa26b791ccb9b953dd74ae3e87312fdca2e93bdd
parent74afbb457aac6a1f6e2d4a2357768f710977a640 (diff)
Adding is_nan tests to the number parsers
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1558 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB.pm3
-rw-r--r--LedgerSMB/Form.pm3
2 files changed, 6 insertions, 0 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 37652d5b..f61ae9a8 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -507,6 +507,9 @@ sub parse_amount {
}
$amount =~ s/\s?CR//;
$amount = new Math::BigFloat($amount);
+ if ($amount->is_nan){
+ $self->error("Invalid number detected during parsing");
+ }
return ( $amount * 1 );
}
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 920870ca..60d0ec19 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -793,6 +793,9 @@ sub parse_amount {
my $decimalplaces = length $1 + length $2;
$amount = new Math::BigFloat($amount);
+ if ($amount->is_nan){
+ $self->error("Invalid number detected during parsing");
+ }
return ( $amount * 1 );
}