diff options
author | mtklein <mtklein@chromium.org> | 2015-12-09 10:02:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-09 10:02:14 -0800 |
commit | 02046c50b294ae2b28e562b0e6e281e4ef823352 (patch) | |
tree | a540f843b8c2f50e1876fb3236090bb2ff2e34b9 /include/core/SkTypes.h | |
parent | f9e658b1d648948ebe37db5cceebd61cddc94575 (diff) |
fix a couple flaky nonnull attribute ubsan warnings
Errors this should fix:
https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/3779/steps/dm/logs/stdio
https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/3779/steps/nanobench/logs/stdio
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot
TBR=reed@google.com
No API changes.
BUG=skia:
Review URL: https://codereview.chromium.org/1504313005
Diffstat (limited to 'include/core/SkTypes.h')
-rw-r--r-- | include/core/SkTypes.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 6c2e636153..e4569f21b1 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -100,7 +100,10 @@ SK_API extern void* sk_calloc_throw(size_t size); // bzero is safer than memset, but we can't rely on it, so... sk_bzero() static inline void sk_bzero(void* buffer, size_t size) { - memset(buffer, 0, size); + // Please c.f. sk_careful_memcpy. It's undefined behavior to call memset(null, 0, 0). + if (size) { + memset(buffer, 0, size); + } } /////////////////////////////////////////////////////////////////////////////// |