Re: Moderated post on self going out of scope
Re: Moderated post on self going out of scope
- Subject: Re: Moderated post on self going out of scope
- From: Ken Thomases <email@hidden>
- Date: Mon, 18 Jan 2010 23:09:32 -0600
On Jan 18, 2010, at 9:50 PM, David Blanton wrote:
> So I set stack-protector-all as "other C++ flags" and got _stack_chk_fail
>
>
> So this means the C++ constructor is corupting the stack?
Sounds like it. I think the backtrace should indicate where the corruption was detected.
Is the C++ class implementation in a library? Does it have different compiler options set than the Objective-C++ file that's using it?
If one module thinks the C++ class takes N bytes (on the stack in this case) and the module with the constructor thinks it takes M bytes, then you can get a result like you're seeing. The constructor code, compiled under one set of assumptions, stores data as appropriate for those assumptions. The client code, compiled under a different set of assumptions, may not set aside the number of bytes required by the constructor's behavior.
Of course, it may just be a garden variety programmer logic error. Have you got all warnings enabled? Are you addressing all the warnings the compiler reports?
You could also show the class declaration, the constructor definition, and the method that's instantiating an instance of the class (and getting its stack smashed).
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden