Index: net/http/transport_security_state_static_fuzzer.cc |
diff --git a/net/http/transport_security_state_static_fuzzer.cc b/net/http/transport_security_state_static_fuzzer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9353aa99b4bcfa6bf6d3227440729fdfde88012f |
--- /dev/null |
+++ b/net/http/transport_security_state_static_fuzzer.cc |
@@ -0,0 +1,49 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+#include <iostream> |
Ryan Sleevi
2016/12/29 00:35:38
This wasn't necessary, was it?
If so, line break
martijnc
2016/12/29 00:39:32
Yes, sorry, forgot to remove it again.
|
+#include <string> |
+ |
+#include "net/http/transport_security_state.h" |
+ |
+namespace net { |
+ |
+class TransportSecurityStateStaticFuzzer { |
+ public: |
+ bool FuzzStaticDomainState(TransportSecurityState* state, |
+ const std::string& input) { |
+ state->enable_static_pins_ = true; |
+ TransportSecurityState::STSState sts_result; |
+ TransportSecurityState::PKPState pkp_result; |
+ return state->GetStaticDomainState(input, &sts_result, &pkp_result); |
+ } |
+ |
+ bool FuzzStaticExpectCTState(TransportSecurityState* state, |
+ const std::string& input) { |
+ state->enable_static_expect_ct_ = true; |
+ TransportSecurityState::ExpectCTState result; |
+ return state->GetStaticExpectCTState(input, &result); |
+ } |
+ |
+ bool FuzzStaticExpectStapleState(TransportSecurityState* state, |
+ const std::string& input) { |
+ state->enable_static_expect_staple_ = true; |
+ TransportSecurityState::ExpectStapleState result; |
+ return state->GetStaticExpectStapleState(input, &result); |
+ } |
+}; |
+ |
+} // namespace net |
+ |
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
+ std::string input(reinterpret_cast<const char*>(data), size); |
+ |
+ net::TransportSecurityStateStaticFuzzer helper; |
+ net::TransportSecurityState state; |
+ |
+ helper.FuzzStaticDomainState(&state, input); |
+ helper.FuzzStaticExpectCTState(&state, input); |
+ helper.FuzzStaticExpectStapleState(&state, input); |
+ |
+ return 0; |
+} |