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

Unified Diff: content/common/origin_trials/trial_token.h

Issue 2383623002: Add a fuzzer for the Origin Trial token parser (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/fuzzer_corpus/origin_trial_token_data/1 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/origin_trials/trial_token.h
diff --git a/content/common/origin_trials/trial_token.h b/content/common/origin_trials/trial_token.h
index ca040c27421fa945989e9740834d250d14ea32c3..73eb3616f677faa51779ae62c6281e54ecb6342a 100644
--- a/content/common/origin_trials/trial_token.h
+++ b/content/common/origin_trials/trial_token.h
@@ -13,6 +13,8 @@
#include "content/common/content_export.h"
#include "url/origin.h"
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
namespace blink {
enum class WebOriginTrialTokenStatus;
}
@@ -60,7 +62,12 @@ class CONTENT_EXPORT TrialToken {
base::Time expiry_time() { return expiry_time_; }
protected:
+ // Tests can access the Parse method directly to validate it, and so are
+ // declared as friends here. All other access to Parse should be made through
+ // TrialToken::From, which will always also ensure that there is a valid
+ // signature attached to the token.
friend class TrialTokenTest;
+ friend int ::LLVMFuzzerTestOneInput(const uint8_t*, size_t);
// If the string represents a properly signed and well-formed token, the token
// payload is returned in the |out_token_payload| parameter and success is
« no previous file with comments | « no previous file | content/test/data/fuzzer_corpus/origin_trial_token_data/1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698