commit | 8ef18d359b2666828957c4c6f03f2ddfa8ce266c | [log] [tgz] |
---|---|---|
author | Andy Weiss <dragonbear@google.com> | Thu Aug 29 10:36:58 2019 -0700 |
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | Fri Aug 30 20:08:21 2019 +0000 |
tree | 72c90922781dac8a0285202b1e90d7745eaf208b | |
parent | 15ecdf94fd36110285e25351dfa40acc158d60d3 [diff] [blame] |
Override operator delete for GrCCPathCache::Key GrCCPathCache::Key allocates extra space for a buffer in Make but using sized delete will then lead to UB as operator delete is not implemented. This change overrides the delete operator to force the unsized variant which gets rid of the UB at the cost of not taking advantage of sized delete. Once P0722R1 is available to safely compute the full size of the object inside delete, this code can change to use sized delete. c.f. https://bugs.chromium.org/p/skia/issues/detail?id=6384 and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0722r1.html Change-Id: Id92edc71374be6880aa362e625bb9a5d20e07ac0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238116 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ccpr/GrCCPathCache.cpp b/src/gpu/ccpr/GrCCPathCache.cpp index 5c5237d..3fcc9aa 100644 --- a/src/gpu/ccpr/GrCCPathCache.cpp +++ b/src/gpu/ccpr/GrCCPathCache.cpp
@@ -75,6 +75,8 @@ return key; } +void GrCCPathCache::Key::operator delete(void* p) { ::operator delete(p); } + const uint32_t* GrCCPathCache::Key::data() const { // The shape key is a variable-length footer to the entry allocation. return reinterpret_cast<const uint32_t*>(reinterpret_cast<const char*>(this) + sizeof(Key));