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

Unified Diff: ipc/param_traits_read_macros.h

Issue 15841011: Implement off-the-wire validation scheme for enum types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct check in content_settings.h Created 7 years, 7 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
« ipc/ipc_message_macros.h ('K') | « ipc/ipc_message_macros.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/param_traits_read_macros.h
diff --git a/ipc/param_traits_read_macros.h b/ipc/param_traits_read_macros.h
index 3fc0ad1f0f05ff4151ff2bcc6ab5dcdcb7cdcfb9..296a84d334e59b3588e7feed5bdd14176b8ddf24 100644
--- a/ipc/param_traits_read_macros.h
+++ b/ipc/param_traits_read_macros.h
@@ -6,6 +6,7 @@
#define IPC_PARAM_TRAITS_READ_MACROS_H_
// Null out all the macros that need nulling.
+#include "base/enum_validation.h"
#include "ipc/ipc_message_null_macros.h"
// STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur.
@@ -39,6 +40,8 @@
int type; \
if (!m->ReadInt(iter, &type)) \
return false; \
+ if (!IsIntValidForEnum<param_type>(type)) \
+ return false; \
*p = static_cast<param_type>(type); \
return true; \
}
« ipc/ipc_message_macros.h ('K') | « ipc/ipc_message_macros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698