Commit Graph

930 Commits

Author SHA1 Message Date
Connor Tumbleson
8254764c6c More robust ResFileValue detection
Previously in 4882396163, strings that
resembled a filepath (ie res/foo/file), would be assigned to a
ResFileValue, which when attempted to be casted to ResScalarValue would
error out.

Attempting to check the filesystem for such files, slowed apktool's
execution majorly. In order to prevent this, the ClassCastException
and other checks related to checking ResFileValue when type is string
was added.

This allows bogus strings such as (res/foo/file) to be added, but the
exception is caught and allows decoding to continues. Fixes #921.
2015-05-14 13:27:22 -05:00
Connor Tumbleson
9cb3df85d8 Catch attr lookup on internal attributes
Internal attributes will fail the AttrDecoder. Catch the errors
and simply return the undecoded value which will be correct. Fixes #913
2015-05-10 07:36:44 -05:00
Connor Tumbleson
48285bde03 Prevent frameworks from modifying sharedLibrary
Since all frameworks are decoded the same via readPackage(), reading
a framework that was a sharedLibrary would throw the sharedLibrary
flag for the apk. Since packageName isn't set until after the first
decode, we check the values to make sure we only set this variable on
the first apk decoded. Refs #936
2015-05-05 07:43:48 -05:00
Connor Tumbleson
1fb87e3e4c Post smali 2.0.6 cleanup
- fix smaliDecoder/AccessorTest to use new DexFileFactory params
 - remove unneeded ds/tree files
 - cleanup unmerged lines
2015-05-02 06:59:36 -05:00
Ben Gruver
4cc5f07fd2 Bump the version number to 2.0.6
Conflicts:
	build.gradle
2015-05-01 10:53:51 -05:00
Ben Gruver
91a47123bf Ensure the stream is closed in DexFileFactory.loadDexFile 2015-05-01 10:53:08 -05:00
Ben Gruver
f803a08711 Upgrade to proguard 5.2.1
Conflicts:
	build.gradle
2015-05-01 10:52:58 -05:00
Rover12421
122af6253c DuplicateTest FAILED fix 2015-05-01 10:52:00 -05:00
Ben Gruver
90e6923ae7 Fix a bounds check problem in IndentingWriter 2015-05-01 10:51:37 -05:00
Ben Gruver
fa773b5382 Comment out unused switch payload instructions 2015-05-01 10:51:27 -05:00
Ben Gruver
7b3e5a1668 Don't wrap a large (>32k) register count in a register directive 2015-05-01 10:51:13 -05:00
Ben Gruver
1c084171ed Duplicate a switch payload that is refered to multiple times 2015-05-01 10:50:38 -05:00
Ben Gruver
395043667a Ensure that sparse switch items are written out in the correct order 2015-05-01 10:50:11 -05:00
Ben Gruver
32a400396d Fix up the whitespace normalization in TextUtils.normalizeWhitespace
Previously, all inter-line whitespace was being removed. And it now
normalizes trailing new lines as well
2015-05-01 10:49:40 -05:00
Ben Gruver
a01bf8c832 Don't propagate exceptions from RoundtripTest.runTest() 2015-05-01 10:49:29 -05:00
Ben Gruver
ce8a993bc7 Extract out a base RoundtripTest and IdenticalRoundtripTest class 2015-05-01 10:49:08 -05:00
Ben Gruver
6d3497f72d Add Member and Annotatable interfaces 2015-05-01 10:48:36 -05:00
Ben Gruver
eb3b01f318 Make sure the elements are sorted in an encoded annotation 2015-05-01 10:48:11 -05:00
Ben Gruver
757e1dac45 Don't assume dx is on-path. Rather, grab it from maven central
The version of dx in maven central seems to be fairly old, but it works
well enough for our purposes.

Conflicts:
	build.gradle
2015-05-01 10:48:00 -05:00
Igor Murashkin
58b7c27316 Add lambda experimental dalvik opcodes
* Add new -X/--experimental flag to [dis]assemble opcodes not in art yet
* Add new opcodes liberate-variable, box-lambda, unbox-lambda,
                  capture-variable, create-lambda, invoke-lambda
* Add support for encoding 25x instructions
* Adds LambdaTest to check new opcodes assemble/disassemble properly

TODO: invoke-lambda-range

Change-Id: I5c8bcbfa8b6cb9a13ef2017fce2d1b7fda6e11c3
2015-05-01 10:46:51 -05:00
Ben Gruver
d54c78d966 Use [^] for the lexer's catch-all rule
[^] matches the entire character set, while . doesn't match new lines, etc.
2015-05-01 10:46:07 -05:00
Ben Gruver
8284715f4d Don't try to test for reserved file names
Instead, we'll just check os.name
2015-05-01 10:45:50 -05:00
Ben Gruver
b903c2066a Enable parallel gradle execution by default 2015-05-01 10:45:01 -05:00
Ben Gruver
df0156aa7e Use single-quotes in build.gradle files when double-quotes aren't needed
Conflicts:
	brut.apktool.smali/baksmali/build.gradle
	brut.apktool.smali/smali/build.gradle
	build.gradle
2015-05-01 10:43:59 -05:00
Ben Gruver
d36b066007 Simplify how the accessorTest is built and run
Conflicts:
	brut.apktool.smali/dexlib2/build.gradle
	brut.apktool.smali/dexlib2/src/accessorTest/java/org/jf/dexlib2/AccessorTest.java
	dexlib2/src/accessorTest/java/org/jf/dexlib2/AccessorTest.java
	dexlib2/src/test/java/org/jf/dexlib2/AccessorTest.java
2015-05-01 10:41:41 -05:00
Ben Gruver
13b4c65ca1 Use the antlr plugin for gradle
Conflicts:
	brut.apktool.smali/smali/build.gradle
	brut.apktool.smali/smali/src/main/antlr3/smaliParser.g
	brut.apktool.smali/smali/src/main/antlr3/smaliTreeWalker.g
	brut.apktool.smali/smali/src/test/antlr3/org/jf/smali/expectedTokensTestGrammar.g
	smali/src/main/antlr/smaliParser.g
	smali/src/main/antlr/smaliTreeWalker.g
	smali/src/main/antlr3/smaliParser.g
	smali/src/main/antlr3/smaliTreeWalker.g
	smali/src/test/antlr/org/jf/smali/expectedTokensTestGrammar.g
	smali/src/test/antlr3/org/jf/smali/expectedTokensTestGrammar.g
2015-05-01 10:37:03 -05:00
Ben Gruver
08dca73690 Use the jflex plugin for gradle
Conflicts:
	brut.apktool.smali/smali/build.gradle
	brut.apktool.smali/smali/src/main/jflex/smaliLexer.flex
	build.gradle
	smali/src/main/jflex/smaliLexer.flex
	smali/src/main/jflex/smaliLexer.jflex
2015-05-01 10:31:01 -05:00
Connor Tumbleson
0003d56389 Switch to Proguard Gradle 2015-05-01 10:26:10 -05:00
Ben Gruver
b8016ae6ef Use the proguard plugin for gradle
Conflicts:
	brut.apktool.smali/baksmali/build.gradle
	brut.apktool.smali/smali/build.gradle
	build.gradle
2015-05-01 09:19:55 -05:00
Connor Tumbleson
46d2fb899f Upgrade to gradle 2.3
- port of b3f933d27a140db265c47d2771937d88e126ac5a
2015-05-01 09:15:56 -05:00
Jiri Hruska
9450cc915c Fix for Dalvik VM crash on parameter annotations
Dalvik VM before Jelly Bean MR1 (4.2) crashes if there are any
NO_OFFSET (0) values in parameter annotation list.
(https://code.google.com/p/android/issues/detail?id=35304)
2015-05-01 09:11:35 -05:00
Ben Gruver
2abcd59cbe Remove stale license noticeds from NOTICE file 2015-05-01 09:09:37 -05:00
Connor Tumbleson
5481376d0c Prevent appending the current directory to path on every run
- Fixes #927
2015-04-29 08:04:20 -05:00
Connor Tumbleson
c659df9dce Correctly add version qualifier when decoding
- fixes #928
2015-04-29 07:49:02 -05:00
Connor Tumbleson
e407fe839b Correctly rebuild /libs & /lib folder on [b]uild 2015-04-22 07:21:02 -05:00
Connor Tumbleson
960d111a1e cleanup unit-tests to remove hacky renaming of control 2015-04-22 07:20:29 -05:00
Connor Tumbleson
4fc78b2508 bump version for start of semantic version increase (2.0.1-SNAPSHOT) 2015-04-21 07:04:37 -05:00
Connor Tumbleson
07ea41bf26 version bump (2.0.0) 2015-04-19 11:02:31 -05:00
Connor Tumbleson
7f3e18e291 [skip] add support for versions with no minor tag 2015-04-19 11:02:02 -05:00
Connor Tumbleson
d76d7d8f11 Merge pull request #911 from iBotPeaches/issue_636
Wires up rewriter of @string references in provider attrs
2015-04-19 10:31:09 -05:00
Connor Tumbleson
14589e3593 If passed string isn't a reference, don't look for it. 2015-04-19 07:44:57 -05:00
Connor Tumbleson
5d405fa842 add a unit-test for provider attr changing 2015-04-18 08:44:25 -05:00
Connor Tumbleson
3208624bf6 Moves all XML parsing related functions to new class: ResXmlPatcher 2015-04-16 08:24:30 -05:00
Connor Tumbleson
addbf8336d [WIP] Wires up rewriter of @string references in provider attrs
- finds all <providers> in manifest
 - finds corresponding @string in res/values/strings.xml
 - does reference replacement w/ literal value
 - fixes #636
2015-04-16 08:24:30 -05:00
Connor Tumbleson
d1cea54cc7 [skip] fix proguard warning 2015-04-16 08:24:13 -05:00
Connor Tumbleson
becaf754a9 [skip] use IOUtils.closeQuietly() 2015-04-16 08:20:18 -05:00
Connor Tumbleson
3cdd8243c7 Read res header completely 2015-04-16 08:14:57 -05:00
Connor Tumbleson
ba9b4af973 Merge branch 'rover12421-del_BrutIO_copy' 2015-04-16 08:12:37 -05:00
Connor Tumbleson
7326867b09 re-add copy() method using try-with-resources 2015-04-16 08:12:20 -05:00
Connor Tumbleson
10afb3cd56 Merge branch 'del_BrutIO_copy' of https://github.com/rover12421/Apktool into rover12421-del_BrutIO_copy 2015-04-16 08:03:44 -05:00