summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 21:34:38 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 21:34:38 +0000
commit80e34f5c0d2074f3c3516664128827f220bc4170 (patch)
tree7c8da7b15e5dd597e4b99c5a460558e910e308dc /chrome/browser/autocomplete
parent05cc4e799b897a440333d3dbe6d18b904a49759f (diff)
downloadchromium_src-80e34f5c0d2074f3c3516664128827f220bc4170.zip
chromium_src-80e34f5c0d2074f3c3516664128827f220bc4170.tar.gz
chromium_src-80e34f5c0d2074f3c3516664128827f220bc4170.tar.bz2
GTK: Strings in the MB range shouldn't overflow and corrupt the omnibox.
BUG=66576 TEST=see bug Review URL: http://codereview.chromium.org/6621074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index 40cf756c..037d970 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -188,6 +188,12 @@ void AutocompletePopupViewGtk::SetupLayoutForMatch(
// elided pure LTR text.
bool marked_with_lre = false;
string16 localized_text = text;
+ // Pango is really easy to overflow and send into a computational death
+ // spiral that can corrupt the screen. Assume that we'll never have more than
+ // 2000 characters, which should be a safe assumption until we all get robot
+ // eyes. http://crbug.com/66576
+ if (localized_text.size() > 2000)
+ localized_text = localized_text.substr(0, 2000);
bool is_rtl = base::i18n::IsRTL();
if (is_rtl && !base::i18n::StringContainsStrongRTLChars(localized_text)) {
localized_text.insert(0, 1, base::i18n::kLeftToRightEmbeddingMark);