diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-08 22:40:35 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-08 22:40:35 +0000 |
commit | f0600f1bba63f638657a524d3738dda728bc2c33 (patch) | |
tree | 7d2d2076d46865ef2b01bf77e511d510e01ae892 /chrome_frame/urlmon_bind_status_callback.cc | |
parent | 85ed9d4d7b61133d67e1a34a0b702f1b02bd1037 (diff) | |
download | chromium_src-f0600f1bba63f638657a524d3738dda728bc2c33.zip chromium_src-f0600f1bba63f638657a524d3738dda728bc2c33.tar.gz chromium_src-f0600f1bba63f638657a524d3738dda728bc2c33.tar.bz2 |
Catch possible out of memory situations when looking for the meta tag.
TEST=See bug.
BUG=46045
Review URL: http://codereview.chromium.org/2728001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_bind_status_callback.cc')
-rw-r--r-- | chrome_frame/urlmon_bind_status_callback.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc index 3483917..da21576 100644 --- a/chrome_frame/urlmon_bind_status_callback.cc +++ b/chrome_frame/urlmon_bind_status_callback.cc @@ -177,12 +177,12 @@ void SniffData::DetermineRendererType(bool last_chance) { if (is_cache_valid() && cache_) { HGLOBAL memory = NULL; GetHGlobalFromStream(cache_, &memory); - char* buffer = reinterpret_cast<char*>(GlobalLock(memory)); + const char* buffer = reinterpret_cast<const char*>(GlobalLock(memory)); std::wstring html_contents; // TODO(joshia): detect and handle different content encodings if (buffer && size_) { - UTF8ToWide(buffer, size_, &html_contents); + UTF8ToWide(buffer, std::min(size_, kMaxSniffSize), &html_contents); GlobalUnlock(memory); } @@ -197,8 +197,8 @@ void SniffData::DetermineRendererType(bool last_chance) { } } DLOG(INFO) << __FUNCTION__ << "Url: " << url_ << - StringPrintf("Renderer type: %s", - renderer_type_ == CHROME ? "CHROME" : "OTHER"); + StringPrintf("Renderer type: %s", + renderer_type_ == CHROME ? "CHROME" : "OTHER"); } } |