1805 Commits

Author SHA1 Message Date
Lanchon
da571dbe71 Use similar formatting for section arrays 2018-07-10 16:09:40 -07:00
Lanchon
fef5569d25 Fix and extend hasOverflowed 2018-07-10 16:09:40 -07:00
Lanchon
2f29256bdf Use a switch statement in mapDexVersionToApi 2018-07-02 11:33:20 -07:00
Lanchon
a237739444 Make mapDexVersionToApi return NO_VERSION in the style of the other maps
Note that this commit silently changes the behavior of dexlib2 public API.
But mapDexVersionToApi was made available only a day ago in dexlib2 2.2.4,
and if the next version is published quickly, then this change should have
no real impact on clients.
2018-07-02 11:33:20 -07:00
Lanchon
9560bfe2a0 Remove the redundant SUPPORTED_DEX_VERSIONS array 2018-07-02 11:33:20 -07:00
Lanchon
1e984c2970 Use the same literals in mapDexVersionToApi and mapApiToDexVersion 2018-07-02 11:33:20 -07:00
Lanchon
dafcef3884 Refactor VersionMap.mapApiToDexVersion out of HeaderItem.getMagicForApi 2018-07-02 11:33:20 -07:00
Ben Gruver
fd3e00ab35 Refactor most of the utility classes from util into dexlib2
Now, util only contains the utilities that are needed by smali/baksmali,
but not dexlib2. E.g. the common command line parsing utilities, some path
utilities, etc.

This also reverses the dependency between the util module and dexlib2.
2018-07-01 14:08:33 -07:00
Lanchon
239b64ba00 Fix accidental dependencies on JCommander outside of dexlib2 2018-06-14 15:13:47 -07:00
Lanchon
2fcdad2078 Fix accidental dependency on JCommander on test 2018-06-13 22:43:25 -07:00
Lanchon
468a4eeba6 Fix mark/reset for new sections (closes #615) 2018-06-13 21:19:05 -07:00
Lanchon
d2b36e16da Fix accidental dependency on JCommander 2018-06-13 21:18:28 -07:00
Lanchon
08bef5f9c2 Fix Gradle's Task.leftShift(Closure) deprecation warning 2018-06-13 14:14:37 -07:00
Wojtek Kaliciński
f16b420b70 Fix for method reference sizes
The protos can be shared across methods so we should not be counting
them as part of private method size.
2018-06-13 14:12:40 -07:00
Lanchon
67e7b39dfc MemoryDataStore: Enforce min growth step and delay allocation of buffer 2018-06-13 14:11:46 -07:00
Lanchon
63896875d4 MemoryDataStore: Efficiently multiply by 1.25 2018-06-13 14:11:46 -07:00
Lanchon
f1c116241a MemoryDataStore: Fail fast on invalid offsets 2018-06-13 14:11:46 -07:00
Lanchon
c41c24a0c2 MemoryDataStore: Support InputStream mark/reset 2018-06-13 14:11:46 -07:00
Lanchon
b9a725e726 MemoryDataStore: Handle weird arguments values correctly
Namely:
- Negative arguments to InputStream::skip(n).
- Large arguments to readAt(offset).
2018-06-13 14:11:46 -07:00
Lanchon
c645b9d546 MemoryDataStore: More efficient overridable growth policy 2018-06-13 14:11:46 -07:00
Lanchon
b0a69fce34 MemoryDataStore: Add a data-trimming getData() method 2018-06-13 14:11:46 -07:00
Lanchon
53cdb13acc MemoryDataStore: Rename the buffer getter method 2018-06-13 14:11:46 -07:00
Lanchon
6917c1fa14 MemoryDataStore: Keep track of actual size of data 2018-06-13 14:11:46 -07:00
Lanchon
d7b389da39 MemoryDataStore: Fix InputStream::read(byte[] b, int off, int len) bug 2018-06-13 14:11:46 -07:00
Lanchon
387299c6e3 MemoryDataStore: Allow overriding of growth policy 2018-06-13 14:11:46 -07:00
Lanchon
ea7c265d12 MemoryDataStore: Fix growth calculation 2018-06-13 14:11:46 -07:00
Albert Gorski
f10643fa43 Handle Changes in OAT Files for Android 8.1 (OAT 131)
- The OAT Header has a new field containing the offset to the
  entries for the DEX files.
    - The change was made in OAT 127.
    - All offsets in the header had to be adjusted to account
      for this new field.
    - The offset to the entries for the DEX files also had to
      be adjusted to use this field as they are no longer
      right after the key value store.
- The format of the DEX entries also changed in OAT 127 and
  again in OAT 131.
    - The field containing the offset to the method bss
      mapping was added in OAT 127.
    - The field containing the offset to the dex sections
      layout was added in OAT 131 right before the method
      bss mapping offset.
2018-06-12 13:39:43 -07:00
ale5000
ec31f76206 Simplified mapApiToArtVersion 2018-06-12 00:52:27 -07:00
Ben Gruver
854f117d3d Bump the version to 2.2.4 2018-06-11 23:34:07 -07:00
Ben Gruver
97fd796213 Bump the gradle version to 4.6 2018-06-11 23:33:49 -07:00
Ben Gruver
5916586f93 Add roundtrip tests for the 2 new opcodes 2018-05-23 13:34:16 -07:00
Ben Gruver
e2cffa23f7 Add support for const-method-handle and const-method-type in the tree walker 2018-05-23 13:34:16 -07:00
Ben Gruver
a387fa8b48 Add support for const-method-handle and const-method-type in the lexer and parser 2018-05-23 13:34:16 -07:00
Ben Gruver
2db1dec703 Add support for dex version 39 in dexlib2 2018-05-23 13:34:16 -07:00
Ben Gruver
69d004cbfd Add a roundtrip test for invoke-custom 2018-05-23 13:34:16 -07:00
Ben Gruver
a198c85a8e Add support for dumping the new structures 2018-05-23 13:34:16 -07:00
Ben Gruver
077c5c1b91 Let baksmali infer the api level when possible 2018-05-23 13:34:16 -07:00
Ben Gruver
e6f4475c87 Add full invoke-custom example 2018-05-23 13:34:16 -07:00
Ben Gruver
48d13b297f Add support for invoke-custom and related structures in baksmali 2018-05-23 13:34:16 -07:00
Ben Gruver
e8760aa46b Add support for method handle and call site references in ReferenceUtil 2018-05-23 13:34:16 -07:00
Ben Gruver
d82252e4d6 Make sure to close the writer after dumping 2018-05-23 13:34:16 -07:00
Ben Gruver
ba7a653fdf Add support for invoke-custom and related structures in the tree walker 2018-05-23 13:34:16 -07:00
Ben Gruver
858d264db9 Change the name of the invoke method handle types
Change the names to match the name used in the smali grammar
2018-05-23 13:34:16 -07:00
Ben Gruver
9ccda3a1bf Add support for invoke-custom and related structures in the parser and lexer 2018-05-23 13:34:16 -07:00
Ben Gruver
c7036da909 Make method_prototype rule build and return a MethodProtoReference 2018-05-23 13:34:16 -07:00
Ben Gruver
0a8839663b "occured" -> "occurred" in SmaliTestUtils 2018-05-23 13:34:16 -07:00
Ben Gruver
5c5e4ae279 Implement support for new structures in DexWriter 2018-05-23 13:34:16 -07:00
Ben Gruver
cc34359691 Create separate section for encoded arrays 2018-05-23 13:34:16 -07:00
Ben Gruver
2d227a7349 Fix nullable issue in annotations rule 2018-05-23 13:34:16 -07:00
Ben Gruver
fa5d0cc73a Add Immutable implementations of the new structures 2018-05-23 13:34:16 -07:00