aboutsummaryrefslogtreecommitdiff
path: root/disassembler.h
AgeCommit message (Collapse)Author
2021-08-13[Zucchini] Replace DISALLOW_* macros with =delete versions.Samuel Huang
This CL replaces * 30 instances of DISALLOW_COPY_AND_ASSIGN(Foo), * 1 instance of DISALLOW_IMPLICIT_CONSTRUCTORS(Foo), in Zucchini with: Foo() = delete; // DISALLOW_IMPLICIT_CONSTRUCTORS only. Foo(const Foo&) = delete; const Foo& operator=(const Foo&) = delete; All base/macros.h includes are removed. Bug: 1010217 Change-Id: I13b3d5ed04f04e5c0b209d59e70ac018c5f4938c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3093198 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#911751} NOKEYCHECK=True GitOrigin-RevId: ba0e1f56993c535faa59e2ca02c371bae2ebbb20
2021-07-25components: Replace base::Optional and friends with absl counterpartsAnton Bikineev
This replaces: - base::Optional -> absl::optional - include "base/optional.h" -> include "third_party/abseil-cpp/absl/types/optional.h" - base::nullopt -> absl::nullopt - base::make_optional -> absl::make_optional Bug: 1202909 Change-Id: If697b7bf69b199c1796f873eedca3359cdb48c64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897151 Commit-Queue: Anton Bikineev <bikineev@chromium.org> Owners-Override: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#883296} NOKEYCHECK=True GitOrigin-RevId: 1156b5f891de178171e71b9221a96bef1ced3d3b
2021-07-25[Zucchini] DisassemblerWin32: Fix rogue |reloc_region_| usage.Samuel Huang
ClusterFuzz found a 32-bit PE file that triggers DCHECK(). The cause (in DisassemblerWin32): * ParseAndStoreRelocBlocks() reads malformed reloc region and rejects it, but writes bad result to |reloc_region_| (with kInvalidOffset). * MakeReadRelocs() passes the invalid |reloc_region_|, which causes uint32_t overflow (for 32-bit size_t), and triggering DCHECK(). * MakeWriteRelocs() was not reached, but has similar problem. Main fix: * Initialize |reloc_region_| to invalid state. * In ParseAndStoreRelocBlocks(): * On first run: Only write |reloc_region_| on success. * On later runs: Return validity of |reloc_region_|. * In MakeReadRelocs() and MakeWriteRelocs(): Already calls ParseAndStoreRelocBlocks(). Change this to return vacuous ReferenceReader / ReferenceWriter on failure, i.e., if |reloc_region_| is invalid. * Need to add EmptyReferenceWriter for this. DisassemblerWin32 is also too lax in dealing with malformed input, so this CL also implments more stringent checks: * Disallow ImageSectionHeader (+ ImageOptionalHeader) from overlapping with ImageDOSHeader. * Apply more stringent checks for |size_of_optional_header| and |number_of_rva_and_sizes|: Consistency and bounds. Bug: 917042 Change-Id: I661303d49a57025a877585eb175f369d067652a4 Reviewed-on: https://chromium-review.googlesource.com/c/1390766 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Cr-Commit-Position: refs/heads/master@{#619316} NOKEYCHECK=True GitOrigin-RevId: d46be686cb9e764befdd39aa168dde62b5314e37
2021-07-25Fix -Wdefaulted-function-deleted warningHans Wennborg
../../components/zucchini/disassembler.h:100:3: warning: explicitly defaulted default constructor is implicitly deleted [-Wdefaulted-function-deleted] ReferenceGroup() = default; ^ ../../components/zucchini/disassembler.h:144:23: note: default constructor of 'ReferenceGroup' is implicitly deleted because field 'traits_' has no default constructor ReferenceTypeTraits traits_; ^ Bug: 890307 Change-Id: Ic7ec04e175f4fb3cc9a32e6a43115485f671b72f Reviewed-on: https://chromium-review.googlesource.com/1256805 Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Hans Wennborg <hans@chromium.org> Cr-Commit-Position: refs/heads/master@{#595813} NOKEYCHECK=True GitOrigin-RevId: 8488f525d97b1c261295d9daf78c38009867f7e6
2021-07-25[Zucchini] Create elf disassembler.Etienne Pierre-doray
Creates Disassembler that recognises and parses ELF format. For now, it only supports Intel architeture. Support for Arm will be added in follow-up CLs. Change-Id: Ibdcf113b573f22844b6a1611c5ff6df46829b9b3 Reviewed-on: https://chromium-review.googlesource.com/1136841 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#582233} NOKEYCHECK=True GitOrigin-RevId: 3c64e078fea9f23e44939c25ca02cf05b72b2c40
2021-07-23zucchini: Swap the order of two declarations.Peter Collingbourne
This allows compilers targeting the MS ABI to select the correct inheritance model for the member function pointer types ReaderFactory and WriterFactory using the complete type of Disassembler. It will allow us to enable the new Clang flag -fcomplete-member-pointers globally. Bug: 847724 Change-Id: Iead5fd97da5f67c336d8904a7a305a34df37065b Reviewed-on: https://chromium-review.googlesource.com/1098470 Commit-Queue: Peter Collingbourne <pcc@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#567016} NOKEYCHECK=True GitOrigin-RevId: fea64fd2f17f40d572923de0705def0016ad4a9f
2021-07-23[Zucchini] Zucchini-gen: Make number of CreateEquivalenceMap() generations ↵Samuel Huang
depend on Disassembler. The number of CreateEquivalenceMap() iterations used be constant kNumIteraitons = 2. This CL makes the value depend on architecture. Current assignment: - DisassemblerNoOp: 1, since no pointers are identified (though in this case, CreateEquivalenceMap() should not be called). - DisassemblerWin32: 2. Upcoming DisassemblerDex will use 4. Also applying generic cleanups on headers and comments. Bug: 729154 Change-Id: Ia12d98fcba500e4c81c8a5d356ce4cadf424ffde Reviewed-on: https://chromium-review.googlesource.com/961273 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542919} NOKEYCHECK=True GitOrigin-RevId: 55aea0a875b80e614464fdd157d9717471f9d64f
2021-07-23[Zucchini] Move Zucchini from /chrome/installer/ to /components/.Samuel Huang
(Use "git log --follow" to see older revisions of files). /components/ is the most logical place to put Zucchini, which only depends on /base and /testing/gtest. This move also enables Zucchini to be used by the Component Updater. Details: - Move all files; run the following to change deps and guards: sed 's/chrome\/installer/components/' *.cc *.h -i sed 's/CHROME_INSTALLER/COMPONENTS/' *.cc *.h -i - Sorting works out pretty well! - Change all 'chrome/installer/zucchini' to 'components/zucchini' throughout other parts of the repo; sort if necessary. - Fix 6 'git cl lint' errors. - Change 1 Bind() usage to BindRepeated(). - Update OWNER. Bug: 729154 Change-Id: I50c5a7d411ea85f707b5994ab319dfb2a1acccf7 Reviewed-on: https://chromium-review.googlesource.com/954923 Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542857} NOKEYCHECK=True GitOrigin-RevId: 577ef6c435e8d43be6e3e60ccbcbd1881780f4ec