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

Unified Diff: courgette/program_detector.h

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, 11 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/patcher_x86_32.h ('k') | courgette/program_detector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/program_detector.h
diff --git a/courgette/program_detector.h b/courgette/program_detector.h
new file mode 100644
index 0000000000000000000000000000000000000000..81b6e2d1a3b4efdb5208d33c4b95b9aef197fa19
--- /dev/null
+++ b/courgette/program_detector.h
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COURGETTE_PROGRAM_DETECTOR_H_
+#define COURGETTE_PROGRAM_DETECTOR_H_
+
+#include <stddef.h>
+
+#include "base/memory/scoped_ptr.h"
+#include "courgette/courgette.h"
+
+namespace courgette {
+
+class AssemblyProgram;
+
+// Detects the type of an executable file, and it's length. The length may be
+// slightly smaller than some executables (like ELF), but will include all bytes
+// the courgette algorithm has special benefit for.
+// On success:
+// Fills in |type| and |detected_length|, and returns C_OK.
+// On failure:
+// Fills in |type| with UNKNOWN, |detected_length| with 0, and returns
+// C_INPUT_NOT_RECOGNIZED.
+Status DetectExecutableType(const void* buffer,
+ size_t length,
+ ExecutableType* type,
+ size_t* detected_length);
+
+// Attempts to detect the type of executable, and parse it with the appropriate
+// tools.
+// On success:
+// Parses the executable into a new AssemblyProgram in |*output|, and returns
+// C_OK.
+// On failure:
+// Returns an error status and assigns |*output| to null.
+Status ParseDetectedExecutable(const void* buffer,
+ size_t length,
+ scoped_ptr<AssemblyProgram>* output);
+
+} // namespace courgette
+
+#endif // COURGETTE_PROGRAM_DETECTOR_H_
« no previous file with comments | « courgette/patcher_x86_32.h ('k') | courgette/program_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698