This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove

On 2017-05-17 07:35, Pedro Alves wrote:
On 04/30/2017 02:51 AM, Simon Marchi wrote:

I think it would be a good guideline to use new/delete for types that
have some C++-related stuff in them, even if it's not technically

Note that this won't be bulletproof also because at many places xfree is used on a void pointer, so we don't know what we're really free'ing. In
some other cases, objects are freed using a pointer to their "C base

Yeah.  Still, better than nothing.

BTW, GCC ran into similar issues almost at the same time
we started discussing this, and I've been discussing
with the GCC folks about a new GCC warning that flags invalid
memcpy/memset misuses.  Martin Sebor has been working on a patch
and it's getting close to be merged, AFAICT.

First version of the GCC patch here:
Discussion crossed month boundary here:
Latest patch is here:

I won't be a full replacement since we'll still want our
poisoning for other functions (xmalloc, xfree, etc.).  And
then there's current/older gccs.  But still, pretty neat, IMO.

Thanks for the info!

I have a branch in progress about poisoning XNEW and friends:

I won't have time to look at it until at least next week, if anybody wants to pick it up, they are free to do so.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]