Re: Integer overflow in operator new

2007-04-06 Thread Karl Chen
> On 2007-04-06 16:12 PDT, Lawrence Crowl writes: Lawrence> Asking programmers to write extra code for rare Lawrence> events, has not been very successful. Well put Lawrence, I agree; I didn't expect strong opposition. I doubt we'd find much code in the wild that checks for integer o

Re: Integer overflow in operator new

2007-04-06 Thread Karl Chen
> On 2007-04-06 15:35 PDT, J C Pizarro writes: J> A possible workaround could be it but it's vulnerable if J> it's defined with -DNDEBUG : J> int * allocate_int(size_t n) { J> // it's another integer overflow, a positive can J> // become to a negative.

Integer overflow in operator new

2007-04-06 Thread Karl Chen
Hi all, apologies if this has been discussed before, but I couldn't find anything about this issue in gcc mailing list archives. Use of operator new (et al) appears to have an integer overflow; this function: int * allocate_int(size_t n) { return new int[n]; } with gcc-