Yes, the C++  Class is in a BSD Static library.

I am checking the compiler options etc now.

I'll let you know the result.

-db


On Jan 18, 2010, at 10:09 PM, Ken Thomases wrote:

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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to