[RFC] Detect most integer overflows.

2013-10-26 Thread Ondřej Bílka
Hi, as I brainstormed how prevent possible overflows in memory allocation I came with heretic idea: For gcc -D_FORTIFY_SOURCE=2 we expand all multiplication with size_t type by one that checks for integer overflow and aborts on it. This would prevent most overflow at cost of breaking some legitima

Re: [RFC] Detect most integer overflows.

2013-10-26 Thread Arnaud Charlet
> Hi, as I brainstormed how prevent possible overflows in memory allocation I > came with heretic idea: > > For gcc -D_FORTIFY_SOURCE=2 we expand all multiplication with size_t > type by one that checks for integer overflow and aborts on it. This > would prevent most overflow at cost of breaking s

Re: [RFC] Detect most integer overflows.

2013-10-26 Thread Ondřej Bílka
On Sat, Oct 26, 2013 at 09:41:36PM +0200, Arnaud Charlet wrote: > > Hi, as I brainstormed how prevent possible overflows in memory allocation I > > came with heretic idea: > > > > For gcc -D_FORTIFY_SOURCE=2 we expand all multiplication with size_t > > type by one that checks for integer overflow

Re: [RFC] Detect most integer overflows.

2013-10-26 Thread Hannes Frederic Sowa
On Sat, Oct 26, 2013 at 09:29:12PM +0200, Ondřej Bílka wrote: > Hi, as I brainstormed how prevent possible overflows in memory allocation I > came with heretic idea: > > For gcc -D_FORTIFY_SOURCE=2 we expand all multiplication with size_t > type by one that checks for integer overflow and aborts o

Re: [RFC] Detect most integer overflows.

2013-10-26 Thread Arnaud Charlet
>>> >>> >>> >> Or alternatively you could use the Ada language where integer overflow >> and buffer overflows are built into the language are fully handled by >> the compiler. >> > Yeah, I will suggest my boss in our project that cost $1 000 000 to > fire all C programmers, hire ada programmer

Re: [RFC] Detect most integer overflows.

2013-10-26 Thread Ondřej Bílka
On Sun, Oct 27, 2013 at 01:50:14AM +0200, Hannes Frederic Sowa wrote: > On Sat, Oct 26, 2013 at 09:29:12PM +0200, Ondřej Bílka wrote: > > Hi, as I brainstormed how prevent possible overflows in memory allocation I > > came with heretic idea: > > > > For gcc -D_FORTIFY_SOURCE=2 we expand all multip