summaryrefslogtreecommitdiffstats
path: root/base/json_reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/json_reader.cc')
-rw-r--r--base/json_reader.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/json_reader.cc b/base/json_reader.cc
index 72ce364..8d0cab4 100644
--- a/base/json_reader.cc
+++ b/base/json_reader.cc
@@ -83,8 +83,11 @@ bool JSONReader::JsonToValue(const std::string& json,
Value** root,
bool check_root,
bool allow_trailing_comma) {
- // Assume input is UTF8. The conversion from UTF8 to wstring removes null
- // bytes for us (a good thing).
+ // The input must be in UTF-8.
+ if (!IsStringUTF8(json.c_str()))
+ return false;
+ // The conversion from UTF8 to wstring removes null bytes for us
+ // (a good thing).
std::wstring json_wide(UTF8ToWide(json));
const wchar_t* json_cstr = json_wide.c_str();