This is the mail archive of the
mailing list for the GCC project.
Re: [PR19351, C++] Fix heap overflow in operator new
* Richard Guenther:
> On Sat, Feb 6, 2010 at 7:47 PM, Florian Weimer <firstname.lastname@example.org> wrote:
>> * Richard Guenther:
>>> Note that it doesn't touch the ABI at all as you only would use
>>> fixed-point types for intermediate computation.
>> You'd need new multiplication routines on some targets.
> Yes, of course. Or have a generic implementation (that of course
> involves control flow again).
That's what I meant with "ABI change".
Anyway, if we're after code size, we really should change the C++ API
to do all the heavy lifting in the run-time library (in particular,
the multiplication and maybe even the constructor/destructor calls
across the freshly-created array). That would avoid adding new
middle-end types, folding logic, and new expanders, of course at the
cost of a C++ ABI change.
I had initially hoped to be able to get the change on the 4.4 branch,
and maybe even the 4.3 branch. But with all those extra changes
around it, this is out of the question. I'm also not familiar with
GCC internals yet. Looks like I have to live with the occasional
operator-new-induced security updated instead. 8-(
>> It's also broken because the code to determine (size_t)-1 failed.
>> What is the correct way to obtain the number of bits in the target
>> size_t type?
> It should be TYPE_PRECISION (size_type_node).