summaryrefslogtreecommitdiffstats
path: root/ipc
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 /ipc
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 'ipc')
-rw-r--r--ipc/ipc_message_utils.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index e05c9c0..9a8ccf4 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -70,12 +70,6 @@ class MessageIterator {
NOTREACHED();
return val;
}
- intptr_t NextIntPtr() const {
- intptr_t val = 0;
- if (!msg_.ReadIntPtr(&iter_, &val))
- NOTREACHED();
- return val;
- }
const std::string NextString() const {
std::string val;
if (!msg_.ReadString(&iter_, &val))
@@ -590,11 +584,13 @@ template <>
struct ParamTraits<HANDLE> {
typedef HANDLE param_type;
static void Write(Message* m, const param_type& p) {
- m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
+ // Note that HWNDs/HANDLE/HCURSOR/HACCEL etc are always 32 bits, even on 64
+ // bit systems.
+ m->WriteUInt32(reinterpret_cast<uint32>(p));
}
static bool Read(const Message* m, void** iter, param_type* r) {
- DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
- return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
+ DCHECK_EQ(sizeof(param_type), sizeof(uint32));
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
}
static void Log(const param_type& p, std::wstring* l) {
l->append(StringPrintf(L"0x%X", p));
@@ -605,11 +601,11 @@ template <>
struct ParamTraits<HCURSOR> {
typedef HCURSOR param_type;
static void Write(Message* m, const param_type& p) {
- m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
+ m->WriteUInt32(reinterpret_cast<uint32>(p));
}
static bool Read(const Message* m, void** iter, param_type* r) {
- DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
- return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
+ DCHECK_EQ(sizeof(param_type), sizeof(uint32));
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
}
static void Log(const param_type& p, std::wstring* l) {
l->append(StringPrintf(L"0x%X", p));
@@ -620,11 +616,11 @@ template <>
struct ParamTraits<HACCEL> {
typedef HACCEL param_type;
static void Write(Message* m, const param_type& p) {
- m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
+ m->WriteUInt32(reinterpret_cast<uint32>(p));
}
static bool Read(const Message* m, void** iter, param_type* r) {
- DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
- return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
+ DCHECK_EQ(sizeof(param_type), sizeof(uint32));
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
}
};