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

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

Issue 1629703002: [Courgette] Refactor: Manage AssemblyProgram and EncodedProgram with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix courgette_fuzzer in libfuzzer. Created 4 years, 10 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "courgette/assembly_program.h" 6 #include "courgette/assembly_program.h"
7 #include "courgette/courgette.h" 7 #include "courgette/courgette.h"
8 #include "courgette/encoded_program.h" 8 #include "courgette/encoded_program.h"
9 9
10 // Entry point for LibFuzzer. 10 // Entry point for LibFuzzer.
11 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { 11 extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
12 courgette::AssemblyProgram* prog; 12 scoped_ptr<courgette::AssemblyProgram> prog;
13 courgette::Status status = 13 courgette::Status status =
14 courgette::ParseDetectedExecutable(data, size, &prog); 14 courgette::ParseDetectedExecutable(data, size, &prog);
15 if (status != courgette::C_OK) { 15 if (status != courgette::C_OK) {
16 return 0; 16 return 0;
17 } 17 }
18 scoped_ptr<courgette::EncodedProgram> enc_prog(prog->Encode()); 18 scoped_ptr<courgette::EncodedProgram> enc_prog(prog->Encode());
19 courgette::DeleteAssemblyProgram(prog);
20 return 0; 19 return 0;
21 } 20 }
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