[openssl-users] [openssl-dev] Changing malloc/debug stuff
Nico Williams
nico at cryptonector.com
Thu Dec 17 22:37:56 UTC 2015
On Thu, Dec 17, 2015 at 08:16:50PM +0000, Salz, Rich wrote:
> > > https://github.com/openssl/openssl/pull/450
> >
> > This seems much more sane.
>
> I'll settle for less insane :)
That is, I think, the best you can do. Some allocations might have
taken place by the time a wrapper or alternative allocator is
installed, in which case something bad will happen. In the case of
alternative allocators the something bad is "it blows up", while in the
case of a wrapper the something bad is "some state/whatever will be
off".
A fully sane approach would be to have every allocated object internally
point to its destructor, and then always destroy by calling that
destructor instead of a global one. (Or call a global one that knows
how to find the object's private destructor pointer, and then calls
that.) If you wish, something more OO-ish. But for many allocations
that's not possible because they aren't "objects" in the sense that
matters. You could always wrap allocations so that they always have
room at the front for the corresponding destructor, then return the
offset of the end of that pointer, but this will be very heavy-duty for
many allocations. So, all in all, I like and prefer your approach.
Nico
--
More information about the openssl-users
mailing list