-
Committer:
Alberto Aguirre
-
Date:
2015-06-17 19:11:14 UTC
-
Revision ID:
alberto.aguirre@canonical.com-20150617191114-2cfjhluzzsjv0oeh
Avoid allocating mir::protobuf objects on the stack
When an addition is made to a protobuf message, a stack allocation of such object may differ from what the destructor of that message is expecting as the destructor is defined by libmirprotobuf and the allocation may have been made from an older definition of the message (by an older mirclient library for example) which can lead to stack corruption.
Ideally, the mirprotobuf library would have versioned symbols and have the ability to be loaded in parallel to a previous version but that's not currently possible.
As an alternative, avoid allocating mir defined protobuf objects on the stack and instead use the xxx::default_instance().New() factory methods which are defined in the mirprotobuf library.
Backport of lp:mir r2674