summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 08:06:35 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-09 08:06:35 +0000
commit3747791d3d47eeaa9aef440bda06b50f594bd386 (patch)
tree20988e5862266fae81e5c6c440507035bc00a3b4 /chrome/common
parent47148a3c6b63d19dd2d33d61537d953f76ce0e2c (diff)
downloadchromium_src-3747791d3d47eeaa9aef440bda06b50f594bd386.zip
chromium_src-3747791d3d47eeaa9aef440bda06b50f594bd386.tar.gz
chromium_src-3747791d3d47eeaa9aef440bda06b50f594bd386.tar.bz2
Take out intptr_t IPC serialization support to prevent people from sending pointers between trusted and untrusted processes. Move HWNDs and other Windows HANDLEs serialization to use 32 bits even on 64 bit platforms since that's all that's needed.
Review URL: http://codereview.chromium.org/565001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/common_param_traits.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
index 97cf7e8..83148a6 100644
--- a/chrome/common/common_param_traits.h
+++ b/chrome/common/common_param_traits.h
@@ -120,17 +120,31 @@ template <>
struct ParamTraits<gfx::NativeWindow> {
typedef gfx::NativeWindow param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, reinterpret_cast<intptr_t>(p));
+#if defined(OS_WIN)
+ // HWNDs are always 32 bits on Windows, even on 64 bit systems.
+ m->WriteUInt32(reinterpret_cast<uint32>(p));
+#else
+ m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p));
+#endif
}
static bool Read(const Message* m, void** iter, param_type* r) {
- intptr_t value;
- if (!ReadParam(m, iter, &value))
- return false;
- *r = reinterpret_cast<param_type>(value);
- return true;
+#if defined(OS_WIN)
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
+#else
+ const char *data;
+ int data_size = 0;
+ bool result = m->ReadData(iter, &data, &data_size);
+ if (result && data_size == sizeof(gfx::NativeWindow)) {
+ memcpy(r, data, sizeof(gfx::NativeWindow));
+ } else {
+ result = false;
+ NOTREACHED();
+ }
+ return result;
+#endif
}
static void Log(const param_type& p, std::wstring* l) {
- LogParam(reinterpret_cast<intptr_t>(p), l);
+ l->append(L"<gfx::NativeWindow>");
}
};