[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1558] trunk



Revision: 1558
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1558&view=rev
Author:   einhverfr
Date:     2007-09-10 16:08:29 -0700 (Mon, 10 Sep 2007)

Log Message:
-----------
Adding is_nan tests to the number parsers

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-09-10 23:02:09 UTC (rev 1557)
+++ trunk/LedgerSMB/Form.pm	2007-09-10 23:08:29 UTC (rev 1558)
@@ -793,6 +793,9 @@
     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 );
 }

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-09-10 23:02:09 UTC (rev 1557)
+++ trunk/LedgerSMB.pm	2007-09-10 23:08:29 UTC (rev 1558)
@@ -507,6 +507,9 @@
     }
     $amount =~ s/\s?CR//;
     $amount = new Math::BigFloat($amount);
+    if ($amount->is_nan){
+        $self->error("Invalid number detected during parsing");
+    }
     return ( $amount * 1 );
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.