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

Unified Diff: third_party/WebKit/Source/core/html/parser/TextResourceDecoderForFuzzing.h

Issue 2261873002: Add fuzzer for HTMLPreloadScanner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add include 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
Index: third_party/WebKit/Source/core/html/parser/TextResourceDecoderForFuzzing.h
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoderFuzzer.cpp b/third_party/WebKit/Source/core/html/parser/TextResourceDecoderForFuzzing.h
similarity index 63%
copy from third_party/WebKit/Source/core/html/parser/TextResourceDecoderFuzzer.cpp
copy to third_party/WebKit/Source/core/html/parser/TextResourceDecoderForFuzzing.h
index e19011319fa1df5c8461662d7fcb9db30b769cce..2b83b9fbc8e4c995437e482d68e4369b8e3d7c81 100644
--- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoderFuzzer.cpp
+++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoderForFuzzing.h
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef TextResourceDecoderForFuzzing_h
+#define TextResourceDecoderForFuzzing_h
+
#include "core/html/parser/TextResourceDecoder.h"
#include "platform/testing/FuzzedDataProvider.h"
-#include "platform/testing/TestingPlatformSupport.h"
#include "wtf/text/WTFString.h"
-#include <algorithm>
namespace blink {
@@ -35,29 +36,6 @@ private:
}
};
-int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
-{
- FuzzedDataProvider fuzzedData(data, size);
- TextResourceDecoderForFuzzing decoder(fuzzedData);
- CString bytes = fuzzedData.ConsumeRemainingBytes();
- decoder.decode(bytes.data(), bytes.length());
- decoder.flush();
- return 0;
-}
-
} // namespace blink
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
-{
- return blink::LLVMFuzzerTestOneInput(data, size);
-}
-
-extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
-{
- // Intentional leak - no need to do cleanup as explained in
- // "Initialization/Cleanup" section of testing/libfuzzer/efficient_fuzzer.md
- DEFINE_STATIC_LOCAL(blink::ScopedUnittestsEnvironmentSetup, testSetup, (*argc, *argv));
- ALLOW_UNUSED_LOCAL(testSetup);
-
- return 0;
-}
+#endif // TextResourceDecoderForFuzzing_h

Powered by Google App Engine
This is Rietveld 408576698