Chromium Code Reviews| Index: base/json/string_escape.cc |
| diff --git a/base/json/string_escape.cc b/base/json/string_escape.cc |
| index f67fa93bf2648191564eb1a77d46664036b1f41d..1ba1210ad4708a6b948e5fc8b3745669b346fe21 100644 |
| --- a/base/json/string_escape.cc |
| +++ b/base/json/string_escape.cc |
| @@ -91,7 +91,8 @@ bool EscapeJSONStringImpl(const S& str, bool put_in_quotes, std::string* dest) { |
| for (int32_t i = 0; i < length; ++i) { |
| uint32_t code_point; |
| - if (!ReadUnicodeCharacter(str.data(), length, &i, &code_point)) { |
| + if (!ReadUnicodeCharacter(str.data(), length, &i, &code_point) || |
| + code_point < 0 || !IsValidCharacter(code_point)) { |
|
Mark Mentovai
2017/05/24 19:02:48
How can code_point, a uint32_t, ever be < 0?
Mark Mentovai
2017/05/24 19:02:48
More importantly, you’re confusing characters with
sabbakumov
2017/05/25 03:26:14
I've updated the documentation.
IsValidCharacter()
sabbakumov
2017/05/25 03:26:14
Thank you. I've mistakenly copy-pasted it from her
sabbakumov
2017/05/25 03:26:14
Done.
sabbakumov
2017/05/25 03:26:14
Done.
|
| code_point = kReplacementCodePoint; |
| did_replacement = true; |
| } |