This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 17 May 2017 12:35:55 +0100
- Subject: Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
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.