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

Unified Diff: ipc/ipc_message_utils.h

Issue 1810243002: Check for unstable types in IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 8 months 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 | « ipc/ipc_message_macros.h ('k') | tools/clang/plugins/CMakeLists.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.h
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index efd669c193498cc40516bbd1d6b0b521885d5582..cf4fa8fb14c5a31f743e5a1969a7b9f32ce4f2a3 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -77,12 +77,26 @@ struct IPC_EXPORT LogData {
struct NoParams {
};
+// Specializations are checked by 'IPC checker' part of find-bad-constructs
+// Clang plugin (see WriteParam() below for the details).
+template <typename... Ts>
+struct CheckedTuple {
+ typedef std::tuple<Ts...> Tuple;
+};
+
template <class P>
static inline void GetParamSize(base::PickleSizer* sizer, const P& p) {
typedef typename SimilarTypeTraits<P>::Type Type;
ParamTraits<Type>::GetSize(sizer, static_cast<const Type&>(p));
}
+// This function is checked by 'IPC checker' part of find-bad-constructs
+// Clang plugin to make it's not called on the following types:
+// 1. long / unsigned long (but not typedefs to)
+// 2. intmax_t, uintmax_t, intptr_t, uintptr_t, wint_t,
+// size_t, rsize_t, ssize_t, ptrdiff_t, dev_t, off_t, clock_t,
+// time_t, suseconds_t (including typedefs to)
+// 3. Any template referencing types above (e.g. std::vector<size_t>)
template <class P>
static inline void WriteParam(base::Pickle* m, const P& p) {
typedef typename SimilarTypeTraits<P>::Type Type;
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | tools/clang/plugins/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698