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
// 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);
+ }
}
///////////////////////////////////////////////////////////////////////////////
// Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture'
dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1;
dst.fKey = new int[dst.fKeySize];
- memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count() * sizeof(int));
+ sk_careful_memcpy(dst.fKey, fSaveLayerOpStack.begin(),
+ fSaveLayerOpStack.count() * sizeof(int));
dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp();
memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySize * sizeof(int));
}