summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/hard_error_handler_win.cc12
-rw-r--r--chrome/common/message_router.cc1
-rw-r--r--chrome/common/render_messages.h1
-rw-r--r--chrome/installer/util/l10n_string_util.cc6
4 files changed, 14 insertions, 6 deletions
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 <string>
#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<USHORT>(str_size_bytes);
+ nt_string->MaximumLength = static_cast<USHORT>(str_size_bytes);
nt_string->Buffer = const_cast<wchar_t*>(str.c_str());
return true;
}
diff --git a/chrome/common/message_router.cc b/chrome/common/message_router.cc
index ae8df62..4b0703e 100644
--- a/chrome/common/message_router.cc
+++ b/chrome/common/message_router.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/common/message_router.h"
-#include "chrome/common/render_messages.h"
void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) {
NOTREACHED() <<
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 3ce88e8..c2410ce 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -56,7 +56,6 @@
#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#endif
namespace base {
diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc
index 32ac7c4..3269516 100644
--- a/chrome/installer/util/l10n_string_util.cc
+++ b/chrome/installer/util/l10n_string_util.cc
@@ -232,7 +232,11 @@ std::wstring GetLocalizedEulaResource() {
// Spaces and DOS paths must be url encoded.
std::wstring url_path =
StringPrintf(L"res://%ls/#23/%ls", full_exe_path, resource);
- DWORD count = url_path.size() * 3;
+
+ // The cast is safe because url_path has limited length
+ // (see the definition of full_exe_path and resource).
+ DCHECK(kuint32max > (url_path.size() * 3));
+ DWORD count = static_cast<DWORD>(url_path.size() * 3);
scoped_array<wchar_t> url_canon(new wchar_t[count]);
HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(),
&count, URL_ESCAPE_UNSAFE);