OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include <stddef.h> |
| 6 #include <stdint.h> |
5 #include "platform/SharedBuffer.h" | 7 #include "platform/SharedBuffer.h" |
6 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
7 #include "platform/mhtml/ArchiveResource.h" | 9 #include "platform/mhtml/ArchiveResource.h" |
8 #include "platform/mhtml/MHTMLParser.h" | 10 #include "platform/mhtml/MHTMLParser.h" |
9 #include "platform/testing/BlinkFuzzerTestSupport.h" | 11 #include "platform/testing/BlinkFuzzerTestSupport.h" |
10 #include <stddef.h> | |
11 #include <stdint.h> | |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // Fuzzer for blink::MHTMLParser. | 15 // Fuzzer for blink::MHTMLParser. |
16 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 16 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
17 static BlinkFuzzerTestSupport test_support = BlinkFuzzerTestSupport(); | 17 static BlinkFuzzerTestSupport test_support = BlinkFuzzerTestSupport(); |
18 MHTMLParser mhtml_parser(SharedBuffer::Create(data, size)); | 18 MHTMLParser mhtml_parser(SharedBuffer::Create(data, size)); |
19 HeapVector<Member<ArchiveResource>> mhtml_archives = | 19 HeapVector<Member<ArchiveResource>> mhtml_archives = |
20 mhtml_parser.ParseArchive(); | 20 mhtml_parser.ParseArchive(); |
21 mhtml_archives.clear(); | 21 mhtml_archives.clear(); |
22 ThreadState::Current()->CollectAllGarbage(); | 22 ThreadState::Current()->CollectAllGarbage(); |
23 | 23 |
24 return 0; | 24 return 0; |
25 } | 25 } |
26 | 26 |
27 } // namespace blink | 27 } // namespace blink |
28 | 28 |
29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
30 return blink::LLVMFuzzerTestOneInput(data, size); | 30 return blink::LLVMFuzzerTestOneInput(data, size); |
31 } | 31 } |
OLD | NEW |