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

Unified Diff: courgette/disassembler_elf_32_x86.h

Issue 2055343002: Courgette: Add static method QuickDetect() to optimize program detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Propagate uint8_t* to unittests and Nits Created 4 years, 6 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
Index: courgette/disassembler_elf_32_x86.h
diff --git a/courgette/disassembler_elf_32_x86.h b/courgette/disassembler_elf_32_x86.h
index 706e6fee33b101e354727ab037ee90942613d43f..8908d28673f084f27e9af1d092e598e47654cf57 100644
--- a/courgette/disassembler_elf_32_x86.h
+++ b/courgette/disassembler_elf_32_x86.h
@@ -20,6 +20,11 @@ class AssemblyProgram;
class DisassemblerElf32X86 : public DisassemblerElf32 {
public:
+ // Returns 'true' if an valid executable is detected using only quick checks.
+ static bool QuickDetect(const uint8_t* start, size_t length) {
+ return DisassemblerElf32::QuickDetect(start, length, EM_386);
+ }
+
class TypedRVAX86 : public TypedRVA {
public:
explicit TypedRVAX86(RVA rva) : TypedRVA(rva) { }
@@ -32,7 +37,7 @@ class DisassemblerElf32X86 : public DisassemblerElf32 {
uint16_t op_size() const override;
};
- DisassemblerElf32X86(const void* start, size_t length);
+ DisassemblerElf32X86(const uint8_t* start, size_t length);
~DisassemblerElf32X86() override { }

Powered by Google App Engine
This is Rietveld 408576698