Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Issue 7064039: Make DetectEncoding() failed when ucsdet_detect() returls NULL. (Closed)

Created:
9 years, 7 months ago by yoshiki
Modified:
9 years, 7 months ago
CC:
chromium-reviews, jshin+watch_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=86509

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M base/i18n/icu_encoding_detection.cc View 1 chunk +4 lines, -0 lines 1 comment Download

Messages

Total messages: 5 (0 generated)
yoshiki
9 years, 7 months ago (2011-05-24 21:24:16 UTC) #1
zel
LGTM http://codereview.chromium.org/7064039/diff/1/base/i18n/icu_encoding_detection.cc File base/i18n/icu_encoding_detection.cc (right): http://codereview.chromium.org/7064039/diff/1/base/i18n/icu_encoding_detection.cc#newcode26 base/i18n/icu_encoding_detection.cc:26: // http://crosbug.com/15691 Please remove this comment, no need ...
9 years, 7 months ago (2011-05-24 22:46:48 UTC) #2
zel
approved for merge into 742
9 years, 7 months ago (2011-05-24 22:49:45 UTC) #3
brettw
Rubber stamp LGTM
9 years, 7 months ago (2011-05-24 22:56:33 UTC) #4
Nebojša Ćirić
9 years, 7 months ago (2011-05-25 16:17:30 UTC) #5
Sorry, was OOO yesterday.

24. мај 2011. 14.24, <yoshiki@chromium.org> је написао/ла:

> Reviewers: Nebojša Ćirić,
>
> Description:
> 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
>
>
> Please review this at http://codereview.chromium.org/7064039/
>
> SVN Base: svn://svn.chromium.org/chrome/trunk/src
>
> Affected files:
>  M base/i18n/icu_encoding_detection.cc
>
>
> Index: base/i18n/icu_encoding_detection.cc
> diff --git a/base/i18n/icu_encoding_detection.cc
> b/base/i18n/icu_encoding_detection.cc
> index
>
3583fa9c5f7436ef02b61e177bc433b488fdc0e6..ce7a372fe13710a36650203765a5439249213c02
> 100644
> --- a/base/i18n/icu_encoding_detection.cc
> +++ b/base/i18n/icu_encoding_detection.cc
> @@ -22,6 +22,10 @@ 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);
> +  // In case that ucsdet_detect() returns NULL with no error
> +  // http://crosbug.com/15691
> +  if (match == NULL)
> +    return false;
>   const char* detected_encoding = ucsdet_getName(match, &status);
>   ucsdet_close(detector);
>
>
>
>


-- 
Nebojša Ćirić

Powered by Google App Engine
This is Rietveld 408576698