diff options
author | wfh <wfh@chromium.org> | 2015-03-12 21:24:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-13 04:24:53 +0000 |
commit | fde55c795a759d11099415c3a2a1f8918b09269a (patch) | |
tree | 32f6046678316635b4f1a20780248960d421ac59 /courgette/encode_decode_unittest.cc | |
parent | a6073a32b9923b1d21406b96ce56b279364c63a0 (diff) | |
download | chromium_src-fde55c795a759d11099415c3a2a1f8918b09269a.zip chromium_src-fde55c795a759d11099415c3a2a1f8918b09269a.tar.gz chromium_src-fde55c795a759d11099415c3a2a1f8918b09269a.tar.bz2 |
Add 64-bit absolute address support to courgette.
Turns out, courgette never really understood 64-bit addresses, and they were all being truncated to 32-bit values. This worked fine, as the high 32-bit part was just serialized as byte data, but would have broken for a 64-bit PE image that straddled the 32-bit boundary.
This CL adds a new op code for ABS64 to ensure that 64-bit math is used when assembling them, but re-uses the existing abs32 streams (since RVA are always 32-bit). This always reduces the size of the patch, but only by a tiny amount, since the four bytes in the absolute addresses no longer need to be stored separately.
This also fixes static cast by reading the 8-byte absolute address from 64-bit binaries.
This change is virtually size neutral. Against test binaries (64-bit chrome.dll 40.0.2214.115->43.0.2317.0) the uncompressed patch sizes were:
before: 10,948,152
after: 10,925,425 (0.2% reduction)
BUG=419996
TEST=courgette_unittests
Review URL: https://codereview.chromium.org/629643002
Cr-Commit-Position: refs/heads/master@{#320449}
Diffstat (limited to 'courgette/encode_decode_unittest.cc')
-rw-r--r-- | courgette/encode_decode_unittest.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/courgette/encode_decode_unittest.cc b/courgette/encode_decode_unittest.cc index a3161ce..4240c5c 100644 --- a/courgette/encode_decode_unittest.cc +++ b/courgette/encode_decode_unittest.cc @@ -70,20 +70,20 @@ void EncodeDecodeTest::TestAssembleToStreamDisassemble( TEST_F(EncodeDecodeTest, PE) { std::string file = FileContents("setup1.exe"); - TestAssembleToStreamDisassemble(file, 971850); + TestAssembleToStreamDisassemble(file, 971851); } TEST_F(EncodeDecodeTest, PE64) { std::string file = FileContents("chrome64_1.exe"); - TestAssembleToStreamDisassemble(file, 814709); + TestAssembleToStreamDisassemble(file, 803782); } TEST_F(EncodeDecodeTest, Elf_Small) { std::string file = FileContents("elf-32-1"); - TestAssembleToStreamDisassemble(file, 135988); + TestAssembleToStreamDisassemble(file, 135989); } TEST_F(EncodeDecodeTest, Elf_HighBSS) { std::string file = FileContents("elf-32-high-bss"); - TestAssembleToStreamDisassemble(file, 7308); + TestAssembleToStreamDisassemble(file, 7309); } |