summaryrefslogtreecommitdiffstats
path: root/content/browser/hyphenator
diff options
context:
space:
mode:
authorgroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 01:17:59 +0000
committergroby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-21 01:17:59 +0000
commit851f97db847f58708dac63ced3c31f7db47f12c5 (patch)
tree3110c1e067028e2d559b3669c73dd8c52e05dbab /content/browser/hyphenator
parent67c807843191600a5c56aa4f85c059c4d65e3e2c (diff)
downloadchromium_src-851f97db847f58708dac63ced3c31f7db47f12c5.zip
chromium_src-851f97db847f58708dac63ced3c31f7db47f12c5.tar.gz
chromium_src-851f97db847f58708dac63ced3c31f7db47f12c5.tar.bz2
[Spellcheck, Security] Filter against invalid locales.
Prevents passing up of garbage strings from renderer (and thus, prevents opening of arbitrary files) BUG=167122 Review URL: https://chromiumcodereview.appspot.com/11618046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/hyphenator')
-rw-r--r--content/browser/hyphenator/hyphenator_message_filter.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/content/browser/hyphenator/hyphenator_message_filter.cc b/content/browser/hyphenator/hyphenator_message_filter.cc
index 3547490..88fa88e 100644
--- a/content/browser/hyphenator/hyphenator_message_filter.cc
+++ b/content/browser/hyphenator/hyphenator_message_filter.cc
@@ -90,6 +90,14 @@ void HyphenatorMessageFilter::OpenDictionary(const string16& locale) {
GetContentClient()->browser()->GetHyphenDictionaryDirectory();
}
std::string rule_file = locale.empty() ? "en-US" : UTF16ToASCII(locale);
+
+ // Currently, only en-US is hyphenated. This is a quick fix for
+ // http://crbug.com/167122.
+ // TODO(groby): The proper fix entails validating if locale is a properly
+ // formatted locale string, but knowledge about valid locales currently
+ // resides in chrome, not content.
+ if (rule_file != "en-US")
+ return;
rule_file.append("-1-0.dic");
FilePath rule_path = dictionary_base_.AppendASCII(rule_file);
dictionary_file_ = base::CreatePlatformFile(