| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ | 5 #ifndef NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ |
| 6 #define NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ | 6 #define NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <string> | 11 #include <string> |
| 9 #include <vector> | 12 #include <vector> |
| 10 | 13 |
| 11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 13 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
| 14 #include "net/spdy/hpack/hpack_decoder.h" | 17 #include "net/spdy/hpack/hpack_decoder.h" |
| 15 #include "net/spdy/hpack/hpack_encoder.h" | 18 #include "net/spdy/hpack/hpack_encoder.h" |
| 16 | 19 |
| 17 namespace net { | 20 namespace net { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 78 |
| 76 // Runs |input_block| through |first_stage| and, iff that succeeds, | 79 // Runs |input_block| through |first_stage| and, iff that succeeds, |
| 77 // |second_stage| and |third_stage| as well. Returns whether all stages | 80 // |second_stage| and |third_stage| as well. Returns whether all stages |
| 78 // processed the input without error. | 81 // processed the input without error. |
| 79 static bool RunHeaderBlockThroughFuzzerStages(FuzzerContext* context, | 82 static bool RunHeaderBlockThroughFuzzerStages(FuzzerContext* context, |
| 80 base::StringPiece input_block); | 83 base::StringPiece input_block); |
| 81 | 84 |
| 82 // Flips random bits within |buffer|. The total number of flips is | 85 // Flips random bits within |buffer|. The total number of flips is |
| 83 // |flip_per_thousand| bits for every 1,024 bytes of |buffer_length|, | 86 // |flip_per_thousand| bits for every 1,024 bytes of |buffer_length|, |
| 84 // rounding up. | 87 // rounding up. |
| 85 static void FlipBits(uint8* buffer, | 88 static void FlipBits(uint8_t* buffer, |
| 86 size_t buffer_length, | 89 size_t buffer_length, |
| 87 size_t flip_per_thousand); | 90 size_t flip_per_thousand); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace net | 93 } // namespace net |
| 91 | 94 |
| 92 #endif // NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ | 95 #endif // NET_SPDY_FUZZING_HPACK_FUZZ_UTIL_H_ |
| OLD | NEW |