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

Side by Side Diff: courgette/disassembler_elf_32.h

Issue 1031513002: Robust ELF header parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef COURGETTE_DISASSEMBLER_ELF_32_H_ 5 #ifndef COURGETTE_DISASSEMBLER_ELF_32_H_
6 #define COURGETTE_DISASSEMBLER_ELF_32_H_ 6 #define COURGETTE_DISASSEMBLER_ELF_32_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "courgette/assembly_program.h" 10 #include "courgette/assembly_program.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual bool ParseHeader(); 89 virtual bool ParseHeader();
90 90
91 virtual bool Disassemble(AssemblyProgram* target); 91 virtual bool Disassemble(AssemblyProgram* target);
92 92
93 // Public for unittests only 93 // Public for unittests only
94 std::vector<RVA> &Abs32Locations() { return abs32_locations_; } 94 std::vector<RVA> &Abs32Locations() { return abs32_locations_; }
95 ScopedVector<TypedRVA> &Rel32Locations() { return rel32_locations_; } 95 ScopedVector<TypedRVA> &Rel32Locations() { return rel32_locations_; }
96 96
97 protected: 97 protected:
98 98
99 uint32 DiscoverLength(); 99 bool UpdateLength();
100 100
101 // Misc Section Helpers 101 // Misc Section Helpers
102 102
103 Elf32_Half SectionHeaderCount() const { 103 Elf32_Half SectionHeaderCount() const {
104 return section_header_table_size_; 104 return section_header_table_size_;
105 } 105 }
106 106
107 const Elf32_Shdr *SectionHeader(int id) const { 107 const Elf32_Shdr *SectionHeader(int id) const {
108 assert(id >= 0 && id < SectionHeaderCount()); 108 assert(id >= 0 && id < SectionHeaderCount());
109 return section_header_table_ + id; 109 return section_header_table_ + id;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 std::vector<RVA> abs32_locations_; 202 std::vector<RVA> abs32_locations_;
203 ScopedVector<TypedRVA> rel32_locations_; 203 ScopedVector<TypedRVA> rel32_locations_;
204 204
205 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); 205 DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32);
206 }; 206 };
207 207
208 } // namespace courgette 208 } // namespace courgette
209 209
210 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_ 210 #endif // COURGETTE_DISASSEMBLER_ELF_32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698