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

Side by Side Diff: testing/libfuzzer/fuzzers/courgette_fuzzer.cc

Issue 2854113002: [Courgette] Reduce AssemblyProgram to reduce Courgette-apply RAM floor and disk churn. (Closed)
Patch Set: Update courgette_fuzzer in libfuzzer. Created 3 years, 7 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
« no previous file with comments | « courgette/program_detector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory>
9
10 #include "courgette/assembly_program.h"
11 #include "courgette/courgette.h" 8 #include "courgette/courgette.h"
12 #include "courgette/encoded_program.h" 9 #include "courgette/courgette_flow.h"
13 #include "courgette/program_detector.h" 10 #include "courgette/region.h"
14 11
15 // Entry point for LibFuzzer. 12 // Entry point for LibFuzzer.
16 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
17 std::unique_ptr<courgette::AssemblyProgram> prog; 14 courgette::CourgetteFlow flow;
18 courgette::Status status = 15 courgette::RegionBuffer buffer(courgette::Region(data, size));
19 courgette::ParseDetectedExecutable(data, size, &prog); 16 flow.ReadDisassemblerFromBuffer(flow.ONLY, buffer);
20 if (status != courgette::C_OK) { 17 flow.CreateAssemblyProgramFromDisassembler(flow.ONLY, false);
21 return 0; 18 flow.CreateEncodedProgramFromDisassemblerAndAssemblyProgram(flow.ONLY);
22 } 19 flow.WriteSinkStreamSetFromEncodedProgram(flow.ONLY);
23 std::unique_ptr<courgette::EncodedProgram> enc_prog(prog->Encode()); 20 // Not bothering to check |flow.failed()|.
24 return 0; 21 return 0;
25 } 22 }
OLDNEW
« no previous file with comments | « courgette/program_detector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698