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

Unified Diff: courgette/program_detector.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/program_detector.h ('k') | testing/libfuzzer/fuzzers/courgette_fuzzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/program_detector.cc
diff --git a/courgette/program_detector.cc b/courgette/program_detector.cc
index cc0f9ced237136c1ee36e998fd7b3936f95068d6..12461f9b530bb9619fc4623cf73f4d5dcef39c1d 100644
--- a/courgette/program_detector.cc
+++ b/courgette/program_detector.cc
@@ -4,9 +4,6 @@
#include "courgette/program_detector.h"
-#include <utility>
-
-#include "courgette/assembly_program.h"
#include "courgette/disassembler.h"
#include "courgette/disassembler_elf_32_arm.h"
#include "courgette/disassembler_elf_32_x86.h"
@@ -15,10 +12,6 @@
namespace courgette {
-namespace {
-
-// Returns a new instance of Disassembler subclass if binary data given in
-// |buffer| and |length| matches a known binary format, otherwise null.
std::unique_ptr<Disassembler> DetectDisassembler(const uint8_t* buffer,
size_t length) {
std::unique_ptr<Disassembler> disassembler;
@@ -46,29 +39,6 @@ std::unique_ptr<Disassembler> DetectDisassembler(const uint8_t* buffer,
return nullptr;
}
-Status ParseDetectedExecutableInternal(
- const uint8_t* buffer,
- size_t length,
- bool annotate_labels,
- std::unique_ptr<AssemblyProgram>* output) {
- output->reset();
-
- std::unique_ptr<Disassembler> disassembler(
- DetectDisassembler(buffer, length));
- if (!disassembler)
- return C_INPUT_NOT_RECOGNIZED;
-
- std::unique_ptr<AssemblyProgram> program =
- disassembler->Disassemble(annotate_labels);
- if (!program.get())
- return C_DISASSEMBLY_FAILED;
-
- *output = std::move(program);
- return C_OK;
-}
-
-} // namespace
-
Status DetectExecutableType(const uint8_t* buffer,
size_t length,
ExecutableType* type,
@@ -87,17 +57,4 @@ Status DetectExecutableType(const uint8_t* buffer,
return C_OK;
}
-Status ParseDetectedExecutable(const uint8_t* buffer,
- size_t length,
- std::unique_ptr<AssemblyProgram>* output) {
- return ParseDetectedExecutableInternal(buffer, length, false, output);
-}
-
-Status ParseDetectedExecutableWithAnnotation(
- const uint8_t* buffer,
- size_t length,
- std::unique_ptr<AssemblyProgram>* output) {
- return ParseDetectedExecutableInternal(buffer, length, true, output);
-}
-
} // namespace courgette
« no previous file with comments | « courgette/program_detector.h ('k') | testing/libfuzzer/fuzzers/courgette_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698