Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1221)

Unified Diff: include/core/SkTArray.h

Issue 1510683002: Add sk_careful_memcpy to catch undefined behavior in memcpy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/common_conditions.gypi ('k') | include/core/SkTDArray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTArray.h
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h
index 401f7084d6e548e0e7931f88031b973549ab735b..9f1bfa1ac18e5d82bba2ba2370f171bdf4876bdc 100644
--- a/include/core/SkTArray.h
+++ b/include/core/SkTArray.h
@@ -23,11 +23,11 @@ inline void copy(SkTArray<T, true>* self, int dst, int src) {
}
template<typename T>
inline void copy(SkTArray<T, true>* self, const T* array) {
- memcpy(self->fMemArray, array, self->fCount * sizeof(T));
+ sk_careful_memcpy(self->fMemArray, array, self->fCount * sizeof(T));
}
template<typename T>
inline void copyAndDelete(SkTArray<T, true>* self, char* newMemArray) {
- memcpy(newMemArray, self->fMemArray, self->fCount * sizeof(T));
+ sk_careful_memcpy(newMemArray, self->fMemArray, self->fCount * sizeof(T));
}
template<typename T>
« no previous file with comments | « gyp/common_conditions.gypi ('k') | include/core/SkTDArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698