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

Side by Side Diff: net/base/fuzzed_data_provider.h

Issue 1919013003: Add fuzzer to test Fuzz URLRequestDataJob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_request_fuzzer
Patch Set: Encapsulated logic in a singleton class. Rebased / updated for FuzzedDataProvider. Created 4 years, 7 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 #ifndef NET_BASE_FUZZED_DATA_PROVIDER_H 5 #ifndef NET_BASE_FUZZED_DATA_PROVIDER_H
6 #define NET_BASE_FUZZED_DATA_PROVIDER_H 6 #define NET_BASE_FUZZED_DATA_PROVIDER_H
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 24 matching lines...) Expand all
35 // |num_bits| must be less than 32. 35 // |num_bits| must be less than 32.
36 uint32_t ConsumeBits(size_t num_bits); 36 uint32_t ConsumeBits(size_t num_bits);
37 37
38 // Same as ConsumeBits(1), but returns a bool. 38 // Same as ConsumeBits(1), but returns a bool.
39 bool ConsumeBool(); 39 bool ConsumeBool();
40 40
41 // Creates a value in the specified range, consuming only as much data is 41 // Creates a value in the specified range, consuming only as much data is
42 // needed. Value may not uniformly distributed in that range. 42 // needed. Value may not uniformly distributed in that range.
43 uint32_t ConsumeValueInRange(uint32_t min, uint32_t max); 43 uint32_t ConsumeValueInRange(uint32_t min, uint32_t max);
44 44
45 size_t ConsumeRemainingBytes(char* dest);
46
47 size_t remaining_bytes() { return remaining_data_.length(); }
48
45 private: 49 private:
46 base::StringPiece remaining_data_; 50 base::StringPiece remaining_data_;
47 51
48 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider); 52 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider);
49 }; 53 };
50 54
51 } // namespace net 55 } // namespace net
52 56
53 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H 57 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/base/fuzzed_data_provider.cc » ('j') | net/base/fuzzed_data_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698