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

Unified Diff: third_party/WebKit/Source/platform/feature_policy/FeaturePolicyFuzzer.cpp

Issue 2420013004: Add a fuzzer for the feature policy string parser. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/feature_policy/FeaturePolicyFuzzer.cpp
diff --git a/third_party/WebKit/Source/platform/json/JSONParserFuzzer.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyFuzzer.cpp
similarity index 50%
copy from third_party/WebKit/Source/platform/json/JSONParserFuzzer.cpp
copy to third_party/WebKit/Source/platform/feature_policy/FeaturePolicyFuzzer.cpp
index 467c0ece0afe1cf3e4cfbdb4c96b3c3c4470c25b..d6863f52fba665f389a35fa3f039e86372eeb389 100644
--- a/third_party/WebKit/Source/platform/json/JSONParserFuzzer.cpp
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyFuzzer.cpp
@@ -2,16 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "platform/json/JSONParser.h"
+#include "platform/feature_policy/FeaturePolicy.h"
-#include "platform/json/JSONValues.h"
+#include "platform/heap/Handle.h"
#include "platform/testing/BlinkFuzzerTestSupport.h"
+#include "platform/weborigin/SecurityOrigin.h"
+#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
+#include <memory>
#include <stddef.h>
#include <stdint.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- blink::parseJSON(WTF::String(data, size));
+ WTF::Vector<WTF::String> messages;
+ RefPtr<blink::SecurityOrigin> origin =
+ blink::SecurityOrigin::createFromString("https://example.com/");
+ std::unique_ptr<blink::FeaturePolicy> policy =
+ blink::FeaturePolicy::createFromParentPolicy(nullptr, origin);
+ policy->setHeaderPolicy(WTF::String(data, size), messages);
return 0;
}
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698