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

Unified Diff: base/json/json_reader.cc

Issue 9860035: Fix handling of Unicode BOMs in JSONReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge origin/master Created 8 years, 9 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 | « base/base.gyp ('k') | base/json/json_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.cc
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index 31eecb44c08027dfc550b9a9ed0f8e61c2bc6d2f..348e471f46b5383d42bb48ade16317fd0a343e5b 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -163,8 +163,9 @@ Value* JSONReader::JsonToValue(const std::string& json, bool check_root,
// or <0xEF 0xBB 0xBF>, advance the start position to avoid the
// JSONReader::BuildValue() function from mis-treating a Unicode BOM as an
// invalid character and returning NULL.
- if (json.size() >= 3 && start_pos_[0] == 0xEF &&
- start_pos_[1] == 0xBB && start_pos_[2] == 0xBF) {
+ if (json.size() >= 3 && static_cast<uint8>(start_pos_[0]) == 0xEF &&
+ static_cast<uint8>(start_pos_[1]) == 0xBB &&
+ static_cast<uint8>(start_pos_[2]) == 0xBF) {
start_pos_ += 3;
}
« no previous file with comments | « base/base.gyp ('k') | base/json/json_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698