Index: include/core/SkTypes.h |
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h |
index 6c2e6361530ac9674da7f69f7b2dd978bb80ce32..e4569f21b1c5a2e6e316c5549ba4ed98420386e3 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); |
+ } |
} |
/////////////////////////////////////////////////////////////////////////////// |