[PATCH] [clang/asan] call __asan_poison_cxx_array_cookie after operator new[]

Kostya Serebryany kcc at google.com
Fri Sep 19 11:09:59 PDT 2014


Richard,
When using expr->getOperatorNew()->isReplaceableGlobalAllocationFunction()
we don't handle operator new defined inside a class (see below).
Using  expr->getNumPlacementArgs() == 0 fixes that but breaks new
(std::nothrow) X[n].

Would you suggest another check that will include all non-placement
operator new cases?


#include <new>
#include <stdlib.h>
class Foo {
 public:
#ifdef OPN
  void *operator new(size_t s);
  void *operator new[] (size_t s);
#endif
  ~Foo();
};

Foo *getFoo(size_t s) {
  return new Foo[s];
}



On Mon, Aug 25, 2014 at 6:33 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> LGTM
>
> http://reviews.llvm.org/D4774
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140919/42f7bbb0/attachment.html>


More information about the cfe-commits mailing list