From 8a861408063765c2b9ab9a76e413c3b1f050552a Mon Sep 17 00:00:00 2001 From: "mrossetti@chromium.org" Date: Fri, 28 Jan 2011 19:59:11 +0000 Subject: 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 --- ipc/ipc_message_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ipc/ipc_message_utils.h') 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 { template <> struct ParamTraits { static void Write(Message* m, const Message& p) { - m->WriteInt(p.size()); - m->WriteData(reinterpret_cast(p.data()), p.size()); + DCHECK(p.size() <= INT_MAX); + int message_size = static_cast(p.size()); + m->WriteInt(message_size); + m->WriteData(reinterpret_cast(p.data()), message_size); } static bool Read(const Message* m, void** iter, Message* r) { int size; -- cgit v1.1