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

Unified Diff: base/json/json_parser.cc

Issue 2321683003: In base::JSONParser, check IsValidCharacter before decoding ASCII/UTF-8. (Closed)
Patch Set: Created 4 years, 3 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 | base/json/json_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser.cc
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index 36e9dcac736938c2e568fbe00c66dea8803f80b0..cf42bfce7229281e28df39521f7bd7cffffe41ec 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -670,7 +670,8 @@ bool JSONParser::ConsumeStringRaw(StringBuilder* out) {
}
int hex_digit = 0;
- if (!HexStringToInt(StringPiece(NextChar(), 2), &hex_digit)) {
+ if (!HexStringToInt(StringPiece(NextChar(), 2), &hex_digit) ||
+ !IsValidCharacter(hex_digit)) {
ReportError(JSONReader::JSON_INVALID_ESCAPE, -1);
return false;
}
« no previous file with comments | « no previous file | base/json/json_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698