[google gcc-4_7, integration] Scribble on destructed strings to catch invalid accesses.

Marc Glisse marc.glisse@inria.fr
Fri Jan 25 10:15:00 GMT 2013


On Thu, 24 Jan 2013, Chris Jefferson wrote:

> On 24/01/13 19:03, Marc Glisse wrote:
>> On Wed, 23 Jan 2013, Paul Pluzhnikov wrote:
>> 
>>> This patch allows us to catch use of destructed strings.
>> 
>> Hello,
>> 
>> while a number of the google debug patches are just cheaper versions (that 
>> don't break the ABI) of what libstdc++'s debug mode provides, this 
>> overwriting of classes on destruction is not as obviously redundant, and I 
>> wonder whether something like it (done consistently for many classes) could 
>> go to trunk...
>
> A possibly crazy suggestion.. How hard would it be to add this automatically 
> to all calls to destructors? (via a command line flag obviously)

Now that you say it, I think I've heard it suggested before :-) Or maybe 
it was overwriting pointers after a call to delete.

It doesn't sound very hard (I could of course be wrong). One issue is that 
when the destructor is manually called (for an object created with 
placement new), it could break code, and although such code would be 
dubious, I am not 100% sure if it is necessarily illegal (probably is). I 
am not sure how it would interact with optimizations either, if gcc would 
remove just the ones it can prove are useless, or all of them.

-- 
Marc Glisse



More information about the Libstdc++ mailing list