summaryrefslogtreecommitdiffstats
path: root/base/i18n
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 23:00:57 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 23:00:57 +0000
commitf7e7ed6aaf600d99e9db6a4af51eec9d8983cb84 (patch)
treed21bbe0756fa6031d5ffc3677ba9454808f3a1ed /base/i18n
parentaff1e883843eb3dd5367b2bc312e7f30397f526b (diff)
downloadchromium_src-f7e7ed6aaf600d99e9db6a4af51eec9d8983cb84.zip
chromium_src-f7e7ed6aaf600d99e9db6a4af51eec9d8983cb84.tar.gz
chromium_src-f7e7ed6aaf600d99e9db6a4af51eec9d8983cb84.tar.bz2
Make DetectEncoding() failed when ucsdet_detect() returls NULL.
In some cases, DetectEncoding() crashes and the reason may be becasue ucsdet_detect() returns NULL with no error status. (cf. http://crosbug.com/15691) BUG=http://crosbug.com/15691 TEST=none Review URL: http://codereview.chromium.org/7064039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n')
-rw-r--r--base/i18n/icu_encoding_detection.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/base/i18n/icu_encoding_detection.cc b/base/i18n/icu_encoding_detection.cc
index 3583fa9..2081c7a 100644
--- a/base/i18n/icu_encoding_detection.cc
+++ b/base/i18n/icu_encoding_detection.cc
@@ -22,6 +22,8 @@ bool DetectEncoding(const std::string& text, std::string* encoding) {
ucsdet_setText(detector, text.data(), static_cast<int32_t>(text.length()),
&status);
const UCharsetMatch* match = ucsdet_detect(detector, &status);
+ if (match == NULL)
+ return false;
const char* detected_encoding = ucsdet_getName(match, &status);
ucsdet_close(detector);