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

Side by Side Diff: third_party/WebKit/Source/platform/mhtml/MHTMLFuzzer.cpp

Issue 2199493002: libFuzzer for blink::MHTMLParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No need for BASE_EXPORT on InitializeICUForTesting (//base/test:test_support is a static_library, n… Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/SharedBuffer.h"
6 #include "platform/heap/Handle.h"
7 #include "platform/mhtml/ArchiveResource.h"
8 #include "platform/mhtml/MHTMLParser.h"
9 #include "platform/testing/TestingPlatformSupport.h"
10 #include "wtf/Assertions.h"
11 #include "wtf/Compiler.h"
12 #include <memory>
13 #include <stddef.h>
mmoroz 2016/08/09 02:24:01 nit: It would be better to include standard header
Łukasz Anforowicz 2016/08/09 21:28:33 Unfortunately, Chromium and Blink style guides dis
mmoroz 2016/08/10 09:12:56 Makes sense, sorry for incorrect suggestion from m
14 #include <stdint.h>
15
16 namespace blink {
17
18 // Fuzzer for blink::MHTMLParser.
19 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
20 {
21 MHTMLParser mhtmlParser(SharedBuffer::create(data, size));
22 HeapVector<Member<ArchiveResource>> mhtmlArchives = mhtmlParser.parseArchive ();
23 mhtmlArchives.clear();
24 ThreadHeap::collectAllGarbage();
25
26 return 0;
27 }
28
29 } // namespace blink
30
31 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
32 {
33 return blink::LLVMFuzzerTestOneInput(data, size);
34 }
35
36 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
37 {
38 // Intentional leak - no need to do cleanup as explained in
39 // "Initialization/Cleanup" section of testing/libfuzzer/efficient_fuzzer.md
40 static blink::ScopedUnittestsEnvironmentSetup testSetup(*argc, *argv);
esprehn 2016/08/10 04:05:29 DEFINE_STATIC_LOCAL(...)
Łukasz Anforowicz 2016/08/10 19:31:17 Done. (it also requires ALLOW_UNUSED_LOCAL(...))
41
42 return 0;
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698