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

Side by Side Diff: net/cert/internal/verify_name_match_fuzzer.cc

Issue 2250263003: Move FuzzedDataProvider to //base and expose to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... also remove PLATFORM_EXPORT Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "net/cert/internal/verify_name_match.h" 5 #include "net/cert/internal/verify_name_match.h"
6 6
7 #include "net/base/fuzzed_data_provider.h" 7 #include "base/test/fuzzed_data_provider.h"
8 #include "net/der/input.h" 8 #include "net/der/input.h"
9 9
10 // Entry point for LibFuzzer. 10 // Entry point for LibFuzzer.
11 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 11 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
12 net::FuzzedDataProvider fuzzed_data(data, size); 12 base::FuzzedDataProvider fuzzed_data(data, size);
13 size_t first_part_size = fuzzed_data.ConsumeUint16(); 13 size_t first_part_size = fuzzed_data.ConsumeUint16();
14 base::StringPiece first_part = fuzzed_data.ConsumeBytes(first_part_size); 14 base::StringPiece first_part = fuzzed_data.ConsumeBytes(first_part_size);
15 base::StringPiece second_part = fuzzed_data.ConsumeRemainingBytes(); 15 base::StringPiece second_part = fuzzed_data.ConsumeRemainingBytes();
16 16
17 net::der::Input in1(first_part); 17 net::der::Input in1(first_part);
18 net::der::Input in2(second_part); 18 net::der::Input in2(second_part);
19 bool match = net::VerifyNameMatch(in1, in2); 19 bool match = net::VerifyNameMatch(in1, in2);
20 bool reverse_order_match = net::VerifyNameMatch(in2, in1); 20 bool reverse_order_match = net::VerifyNameMatch(in2, in1);
21 // Result should be the same regardless of argument order. 21 // Result should be the same regardless of argument order.
22 CHECK_EQ(match, reverse_order_match); 22 CHECK_EQ(match, reverse_order_match);
23 return 0; 23 return 0;
24 } 24 }
OLDNEW
« no previous file with comments | « net/base/fuzzed_data_provider.cc ('k') | net/cert/internal/verify_name_match_verifynameinsubtree_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698