r14512 - gnucash/trunk/lib/libqof/qof - Avoid SIGFPE due to modulo-by-zero is the requested number of significant
Chris Shoemaker
chris at cvs.gnucash.org
Sat Jul 15 15:47:03 EDT 2006
Author: chris
Date: 2006-07-15 15:47:02 -0400 (Sat, 15 Jul 2006)
New Revision: 14512
Trac: http://svn.gnucash.org/trac/changeset/14512
Modified:
gnucash/trunk/lib/libqof/qof/gnc-numeric.c
Log:
Avoid SIGFPE due to modulo-by-zero is the requested number of significant
figures is greater than log10(2^63).
BP
Modified: gnucash/trunk/lib/libqof/qof/gnc-numeric.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-numeric.c 2006-07-15 17:07:40 UTC (rev 14511)
+++ gnucash/trunk/lib/libqof/qof/gnc-numeric.c 2006-07-15 19:47:02 UTC (rev 14512)
@@ -785,6 +785,9 @@
}
sigfigs = GNC_HOW_GET_SIGFIGS(how);
+ if (fabs(sigfigs - logratio) > 18)
+ return gnc_numeric_error(GNC_ERROR_OVERFLOW);
+
if(sigfigs-logratio >= 0) {
denom = (gint64)(pow(10, sigfigs-logratio));
}
More information about the gnucash-changes
mailing list