From ca36c789c4284f53f61e6c308c6928f8bdc51bb4 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 10 Sep 2007 23:08:29 +0000 Subject: 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 --- LedgerSMB.pm | 3 +++ LedgerSMB/Form.pm | 3 +++ 2 files changed, 6 insertions(+) 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 ); } -- cgit v1.2.3