diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 19:59:11 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 19:59:11 +0000 |
commit | 8a861408063765c2b9ab9a76e413c3b1f050552a (patch) | |
tree | 104c4c1cc240bfc4774eaf2aea529f8cc4ce393c /ipc/ipc_message_utils.h | |
parent | 9d44b21e1c59e8483fdb9edcd5d8745e08fe6e7e (diff) | |
download | chromium_src-8a861408063765c2b9ab9a76e413c3b1f050552a.zip chromium_src-8a861408063765c2b9ab9a76e413c3b1f050552a.tar.gz chromium_src-8a861408063765c2b9ab9a76e413c3b1f050552a.tar.bz2 |
Change size() function to return a size_t so that result size is not inadvertently truncated.
BUG=None
TEST=Ran existing unit tests and trybots.
Review URL: http://codereview.chromium.org/6386008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_message_utils.h')
-rw-r--r-- | ipc/ipc_message_utils.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 723a0b3..2b0fcef 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -765,8 +765,10 @@ struct ParamTraits<LogData> { template <> struct ParamTraits<Message> { static void Write(Message* m, const Message& p) { - m->WriteInt(p.size()); - m->WriteData(reinterpret_cast<const char*>(p.data()), p.size()); + DCHECK(p.size() <= INT_MAX); + int message_size = static_cast<int>(p.size()); + m->WriteInt(message_size); + m->WriteData(reinterpret_cast<const char*>(p.data()), message_size); } static bool Read(const Message* m, void** iter, Message* r) { int size; |