r23494 - gnucash/trunk/src - Test for overflow limits in gnc_numeric_add.

John Ralls jralls at ceridwen.us
Sat Dec 7 13:05:12 EST 2013


On Dec 7, 2013, at 7:41 AM, Geert Janssens <janssens-geert at telenet.be> wrote:

> On Thursday 05 December 2013 16:54:28 John Ralls wrote:
>> Author: jralls
>> Date: 2013-12-05 16:54:28 -0500 (Thu, 05 Dec 2013)
>> New Revision: 23494
>> Trac: http://svn.gnucash.org/trac/changeset/23494
>> 
>> Added:
>>   gnucash/trunk/src/libqof/qof/test/test-gnc-numeric.c
>> Modified:
>>   gnucash/trunk/src/engine/test/test-numeric.c
>>   gnucash/trunk/src/libqof/qof/gnc-numeric.c
>> Log:
>> Test for overflow limits in gnc_numeric_add.
>> 
>> For analysis of Bug 665707.
>> 
> <snip>
>> 
>> Modified: gnucash/trunk/src/libqof/qof/gnc-numeric.c
>> 
> ==========================================================
> =========
>> --- gnucash/trunk/src/libqof/qof/gnc-numeric.c	2013-12-05 21:54:18 UTC
>> (rev 23493) +++ gnucash/trunk/src/libqof/qof/gnc-numeric.c	2013-12-05
>> 21:54:28 UTC (rev 23494) @@ -45,6 +45,23 @@
>> 
>> /* static short module = MOD_ENGINE; */
>> 
>> +gint64
>> +pwr64 (gint64 op, int exp)
>> +{
>> +    qofint128 tmp;
>> +    if (exp == 0) return 1;
>> +    if (exp % 2)
>> +    {
>> +	tmp = mult128 (op, pwr64 (op, exp - 1));
>> +	if (tmp.isbig) return 0;
>> +	return tmp.lo;
>> +    }
>> +    tmp.lo = pwr64 (op, exp / 2);
>> +    tmp = mult128 (tmp.lo, tmp.lo);
>> +    if (tmp.isbig) return 0;
>> +    return tmp.lo;
>> +}
>> +
> 
> This addition breaks the build on my machine with error:
> no previous prototype for 'pwr64' [-Werror=missing-prototypes]
> pwr64 (gint64 op, int exp)
> 

Sorry. I’d actually found that when I cross-checked the commit on F18 before pushing it, but
apparently failed to commit the fix. r23509.

BTW, thanks for back-porting all of the SQL fixes to 2.4.

Regards,
John Ralls





More information about the gnucash-devel mailing list