[Developers] [Patches] fix to integer overflow bug in PUGH

Rideout, David P d.rideout at imperial.ac.uk
Fri Apr 6 17:33:23 CDT 2007


How about casting it to an unsigned long instead?  (Just because in principle one may be interested in the exact value.)

-David


-----Original Message-----
From: developers-bounces at cactuscode.org on behalf of Erik Schnetter
Sent: Fri 06-Apr-07 11:21 PM
To: developers at cactuscode.org
Subject: Re: [Developers] [Patches] fix to integer overflow bug in PUGH
 
On Apr 6, 2007, at 15:36:25, David Rideout wrote:

> The malloc calls in PUGH compute the size to allocate from an int  
> expression. This patch casts such expressions to size_t.  This  
> fixes PR 2088.
>
> Patch also includes a check that malloc returns a non-NULL result...

The patch looks fine with one exception.  You cannot print a value of  
type size_t with %lu.  I suggest to convert the value to double and  
to print it with %f instead.

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.





-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3283 bytes
Desc: not available
Url : http://www.cactuscode.org/pipermail/developers/attachments/20070406/fd730364/attachment.bin 


More information about the Developers mailing list