| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Returns a uint8_t from the input or 0 if nothing remains. This is | 45 // Returns a uint8_t from the input or 0 if nothing remains. This is |
| 46 // equivalent to ConsumeValueInRange(0, 0xFF). | 46 // equivalent to ConsumeValueInRange(0, 0xFF). |
| 47 uint8_t ConsumeUint8(); | 47 uint8_t ConsumeUint8(); |
| 48 | 48 |
| 49 // Returns a uint16_t from the input. If fewer than 2 bytes of data remain | 49 // Returns a uint16_t from the input. If fewer than 2 bytes of data remain |
| 50 // will fill the most significant bytes with 0. This is equivalent to | 50 // will fill the most significant bytes with 0. This is equivalent to |
| 51 // ConsumeValueInRange(0, 0xFFFF). | 51 // ConsumeValueInRange(0, 0xFFFF). |
| 52 uint16_t ConsumeUint16(); | 52 uint16_t ConsumeUint16(); |
| 53 | 53 |
| 54 // Reports the remaining bytes available for fuzzed input. |
| 55 size_t remaining_bytes() { return remaining_data_.length(); } |
| 56 |
| 54 private: | 57 private: |
| 55 base::StringPiece remaining_data_; | 58 base::StringPiece remaining_data_; |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider); | 60 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace net | 63 } // namespace net |
| 61 | 64 |
| 62 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H | 65 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H |
| OLD | NEW |