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

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: Addressed CR feedback from mmoroz@. 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
13 #include <base/command_line.h>
tkent 2016/08/02 23:00:45 Do not use |#include <>| for chromium headers.
Łukasz Anforowicz 2016/08/03 16:02:46 Done. This change is also making the includes be
14 #include <base/i18n/icu_util.h>
15
16 #include <memory>
17
18 #include <stddef.h>
19 #include <stdint.h>
20
21
22 namespace blink {
23
24 // Fuzzer for blink::MHTMLParser.
25 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
26 {
27 MHTMLParser mhtmlParser(SharedBuffer::create(data, size));
28 HeapVector<Member<ArchiveResource>> mhtmlArchives = mhtmlParser.parseArchive ();
29 mhtmlArchives.clear();
30 ThreadHeap::collectAllGarbage();
31
32 return 0;
33 }
34
35 } // namespace blink
36
37 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
38 {
39 return blink::LLVMFuzzerTestOneInput(data, size);
40 }
41
42 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
43 {
44 base::CommandLine::Init(*argc, *argv);
45 base::i18n::InitializeICU();
46
47 // Intentional leak - no need to do cleanup as explained in
48 // "Initialization/Cleanup" section of testing/libfuzzer/efficient_fuzzer.md
49 static blink::ScopedUnittestsEnvironmentSetup testSetup;
50
51 return 0;
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698