From 50c7eb8a256dfbff20f5434f78a3f4f537c4239b Mon Sep 17 00:00:00 2001 From: "gregoryd@google.com" Date: Tue, 10 Nov 2009 21:58:07 +0000 Subject: Add 64 bit support + code cleanup TEST=none BUG=none Review URL: http://codereview.chromium.org/374022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31604 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/hard_error_handler_win.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'chrome/app') diff --git a/chrome/app/hard_error_handler_win.cc b/chrome/app/hard_error_handler_win.cc index 77a8f81..26c64ff 100644 --- a/chrome/app/hard_error_handler_win.cc +++ b/chrome/app/hard_error_handler_win.cc @@ -9,6 +9,7 @@ #include #include "base/basictypes.h" +#include "base/logging.h" #include "base/string_piece.h" #include "base/sys_string_conversions.h" @@ -26,9 +27,14 @@ bool MakeNTUnicodeString(const std::wstring& str, UNICODE_STRING* nt_string) { if (str.empty()) return false; - uint32 str_size_bytes = str.size() * sizeof(wchar_t); - nt_string->Length = str_size_bytes; - nt_string->MaximumLength = str_size_bytes; + size_t str_size_bytes = str.size() * sizeof(wchar_t); + if (kuint16max < str_size_bytes) { + // The string is too long - nt_string->Length is USHORT + NOTREACHED() << "The string is too long"; + return false; + } + nt_string->Length = static_cast(str_size_bytes); + nt_string->MaximumLength = static_cast(str_size_bytes); nt_string->Buffer = const_cast(str.c_str()); return true; } -- cgit v1.1