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

Unified Diff: components/translate/core/language_detection/language_detection_util.cc

Issue 1964823003: Initialize CLD score/language arrays prior to use, for pedantic safety. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize double array with double values Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/core/language_detection/language_detection_util.cc
diff --git a/components/translate/core/language_detection/language_detection_util.cc b/components/translate/core/language_detection/language_detection_util.cc
index 56289a46332949cdb65b1d5781c882ed4744e480..4acc0dea4f1de5412d3fee42fafbf409df5f4f8a 100644
--- a/components/translate/core/language_detection/language_detection_util.cc
+++ b/components/translate/core/language_detection/language_detection_util.cc
@@ -86,11 +86,12 @@ std::string DetermineTextLanguage(const base::string16& text,
const int num_utf8_bytes = static_cast<int>(utf8_text.size());
const char* raw_utf8_bytes = utf8_text.c_str();
- CLD2::Language language3[3];
- int percent3[3];
+ CLD2::Language language3[3] = {
+ CLD2::UNKNOWN_LANGUAGE, CLD2::UNKNOWN_LANGUAGE, CLD2::UNKNOWN_LANGUAGE};
+ int percent3[3] = {0, 0, 0};
int flags = 0; // No flags, see compact_lang_det.h for details.
int text_bytes; // Amount of non-tag/letters-only text (assumed 0).
- double normalized_score3[3];
+ double normalized_score3[3] = {0.0, 0.0, 0.0};
const char* tld_hint = "";
int encoding_hint = CLD2::UNKNOWN_ENCODING;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698