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

Side by Side Diff: base/json/json_parser_unittest.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 unified diff | Download patch
« no previous file with comments | « base/json/json_parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/json/json_parser.h" 5 #include "base/json/json_parser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 317
318 TEST_F(JSONParserTest, DecodeUnicodeNonCharacter) { 318 TEST_F(JSONParserTest, DecodeUnicodeNonCharacter) {
319 // Tests Unicode code points (encoded as escaped UTF-16) that are not valid 319 // Tests Unicode code points (encoded as escaped UTF-16) that are not valid
320 // characters. 320 // characters.
321 EXPECT_FALSE(JSONReader::Read("[\"\\ufdd0\"]")); 321 EXPECT_FALSE(JSONReader::Read("[\"\\ufdd0\"]"));
322 EXPECT_FALSE(JSONReader::Read("[\"\\ufffe\"]")); 322 EXPECT_FALSE(JSONReader::Read("[\"\\ufffe\"]"));
323 EXPECT_FALSE(JSONReader::Read("[\"\\ud83f\\udffe\"]")); 323 EXPECT_FALSE(JSONReader::Read("[\"\\ud83f\\udffe\"]"));
324 } 324 }
325 325
326 TEST_F(JSONParserTest, DecodeNegativeEscapeSequence) {
327 EXPECT_FALSE(JSONReader::Read("[\"\\x-A\"]"));
328 EXPECT_FALSE(JSONReader::Read("[\"\\u-00A\"]"));
329 }
330
326 } // namespace internal 331 } // namespace internal
327 } // namespace base 332 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698