certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [certi-dev] Memory issues


From: David Come
Subject: Re: [certi-dev] Memory issues
Date: Fri, 28 Aug 2015 12:54:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Ok, I found the bug.

It was obvious, but it seems I'm rustier in C++ than I though.
In OwnershipManagement::attributeOwnedByFederate in files RTIA/OwnershipManagement.cc, the return type is const char*
The address returned belongs to rep->label. rep is auto_ptr, thus when leaving the function rep goes out of scope and so does label
and the address is no longer valid ....

I fixed by simply returning a std::string, I'll create a git commit and push it on my github soon.

David.

rep
did you test whether if the message was Tagged in the first place before trying
to consult the tag?

see rep.isTagged()

may be BasicMessage class should be fixed in order to initialize strings member
(e.g. tag and wtag in your case) to default values in the default protected constructor.
 

I can reproduce the bug, I'll try to figure it tomorrow.
I'm not sure if that issue is linked to the strict aliasing rule

I doubt it, but who knows... :-)

Thank you very much for hunting those bugs.
 
--
CERTI-Devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/certi-devel




--
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]