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
This commit is contained in:
parent
f9e658b1d6
commit
02046c50b2
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -693,7 +693,8 @@ private:
|
||||
// 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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user