New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jasmin errors while transforming APK to Java class #131
Comments
Can you please send me the apk file to Steven.Arzt@cased.de? I'll then have a look at it. |
I dont have the exact same file, but I tested another file and found similar issue. Will mail that file to you. Log D:\Tests>java -Xms512m -jar soot.jar -allow-phantom-refs -src-prec apk -android D:\Tests> |
Attached APK file. Password is 123.
http://www.flickr.com/photos/yogiam/ On Tue, Oct 8, 2013 at 6:47 PM, Steven Arzt notifications@github.comwrote:
|
Filename is the issue. If I remove the space in file name, e.g make "Kitchen Timer.apk" to "KitchenTimer.apk", everything works fine. |
The problem is the source file tag associated with a class when we fill it with the name of the APK file. Fixed in commit d2d4f65 Please confirm the fix and close the issue if it works. |
Will test with the nightly build and confirm.
http://www.flickr.com/photos/yogiam/ On Wed, Oct 9, 2013 at 1:45 PM, Steven Arzt notifications@github.comwrote:
|
Tested. Fixed. |
Hi Steven, Same issue arises with another file. Log below. Will email the file to you. D:\Tests>java -Xms512m -jar soot.jar -allow-phantom-refs -src-prec apk -android ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ D:\Tests> |
I cannot reproduce this issue. Are you sure that you are using the newest version of Soot? |
Tested with the nightly build. Attached zip file with apk and complete log.
http://www.flickr.com/photos/yogiam/ On Thu, Oct 10, 2013 at 8:30 PM, Steven Arzt notifications@github.comwrote:
|
The issue is now reproducible for some reason. I'll have a look at it. |
@Alexandre-Bartel This error is caused by Jasmin complaining about an annotation originally read from a DEX file. You said something about this being work in progress on the phone today because of Jasmin and Dexpler using different representations. I think the following Jasmin code is the problem, can you confirm this?
To me, this simple looks as if the L in the beginning and the semicolon at then end are wrong since Jasmin does not use this format anywhere else, superclasses etc. are just of the format "a/b/c". |
@StevenArzt Right, at the moment annotations read from Dalvik cause problem when converted to Jasmin. I'm working on this. |
@StevenArzt This bug should have been fixed in commit a6d3442. Could you confirm and send me the apk for reference? |
@Alexandre-Bartel It seems to work now, thanks. I have sent you the APK file via e-mail @yogiam Can you confirm the fix as well and close the issue? |
OK.
http://www.flickr.com/photos/yogiam/ On Sat, Oct 19, 2013 at 5:39 PM, Steven Arzt notifications@github.comwrote:
|
Tested with nightly build. Issue still exists. Attached zip file(password
http://www.flickr.com/photos/yogiam/ On Mon, Oct 21, 2013 at 11:52 AM, Yogesh A. Mujumdar <
|
This is a different issue than the one discussed above. In this case, Jasmin fails to write out the .class file because of a class named "is" which is a reserved token in Jasmin. The offending line seems to be: .interface public abstract is @ericbodden Could you please have a look at the issue? |
Steven can you please attach the offending .jasmin file? Cheers, On 21.10.2013, at 14:51, Steven Arzt notifications@github.com wrote:
|
Note that this issue also occurs for Jasmin instructions such as "new is" jasmin/ReservedWords.java tells us that this can happen with the On Mon, 2013-10-21 at 05:51 -0700, Steven Arzt wrote:
|
|
Sorry, that was the wrong button, I did not intend to close the issue... |
Thanks for the info Alex. I guess we require some escaping there (or a stateful lexer). I am surprised that this did not occur before, actually. I guess the only thing that saved us so far is that class names typically start with an uppercase letter. Eric On 21.10.2013, at 15:01, Alexandre-Bartel notifications@github.com wrote:
|
This problem is introduced by obfuscation tools such as proguard. This On Mon, 2013-10-21 at 06:11 -0700, Eric Bodden wrote:
|
The keywords is, from, to are apparently only used in the following rule... // It seems to me like code matching this rule is never, however, generated by Soot. I wondr what it is even good for. Maybe an annotation of variable types? Anyway, I would suggest to simply rename the keywords to something longer that obfuscators are less likely to generate. Another problem with the code that Steven sent seems to be the source annotation: |
This annotation is generated out of the file name of the APK file which has such a weird name. There is already some hacking in Soot to sanitize the APK file name to avoid issues with Jasmin, so if we need to exclude (i.e. replace) more characters here, just let me know and I'll add them to the substitution list. The idea is to give the user some hint as to where the source originally came from - though this requires some character substitutions. |
Well, currently I just get: jas.jasError: Badly formatted number You can test this yourself by running jasmin.Main with the parameter is.jasmin where is.jasmin is a file containing the Jasmin code. Eric On 21.10.2013, at 16:44, Steven Arzt notifications@github.com
|
Yes, Dexpler is generating this annotation. I have updated the code to make sure the name always starts with a letter. |
@ericbodden I would suggest adding a dot '.' before the keywords if that still make sense. |
Appropriate change pushed to jasmin/develop. |
There still seems to be something wrong when trying to process the sample APK. The failing class is called fs. Jasmin code:
Error message:
Has some of the reserved word renaming maybe affected fixed parts of the Jasmin language? |
This is weird. If I revert the previous change then Jasmin is running out of memory on this input! WTH!? |
The problem is that the '.method' keyword already exists: 43 reserved_words.put(".method", new Symbol(sym.DMETHOD)); On Wed, 2013-10-23 at 01:31 -0700, Eric Bodden wrote:
|
By the way the keywords FROM TO and USING are also used in the .catch rule: src/jasmin/parser.cup |
I have reverted the previous change but I am also not seeing a solution right now. I don't understand why simply changing or removing the keyword definition is breaking the parser. The scanner is hand written, though, which might explain things. It's probably badly designed and comes with lots of internal constraints. I don't have much time to look into this any further right now. Any volunteers? |
@Alexandre-Bartel even if I just rename "is" to ".is" in the reserved keywords or if I remove the line entirely does the parser run out of memory... |
@ericbodden Renanming "is" to ".is" is working fine on my side. $ java -classpath /home/alex/src/sable-jasmin.git/lib/jasminclasses-2.2.1.jar:/home/alex/src/sable-polyglot.git/lib/java_cup.jar jasmin.Main fs.jasmin |
Thanks Alex. I pushed another change that just modifies "is" to be ".is" instead: c90a67d9aeb9f62ce94cdec98fb9e012f3f578d1 I guess something must be wrong with my Eclipse setup. I also cannot reproduce the memory issue on the command line. Note that this does not fix the problem entirely. "to" is still a keyword used for traps. |
The fix seems to resolve the issue with the APK. @yogiam Can you confirm this? |
I pushed another change that should take care of all Jasmin keywords posing problem (the ones not starting with a dot): @StevenArzt @yogiam Could you confirm that the second app. is working with this? |
Will test and get back.
http://www.flickr.com/photos/yogiam/ On Thu, Oct 24, 2013 at 10:20 PM, Alexandre-Bartel <notifications@github.com
|
Tested. I dont get the warning anymore. Closing. Thanks. |
Command:
java -Xms512m -jar soot.jar -allow-phantom-refs -src-prec apk -android-jars C:/android/sdk/platforms -outjar -process-dir a.apk
Error:
r.class
Writing to kawa\lang\Pattern.class
Writing to com\google\devtools\simple\runtime\components\android\ContactPicker.c
lass
Jasmin:20: Warning - Syntax error.
^
Jasmin:20: Error - Couldn't repair and continue parse.
^
Jasmin: Found 2 errors
Writing to com\google\devtools\simple\runtime\variants\IntegerVariant.class
Writing to com\google\devtools\simple\runtime\components\android\ListPickerActiv
ity.class
Writing to twitter4j\TwitterStream$StreamHandlingThread.class
I also get the error at different points while writing different classes. below is the list.
Other places where it gives error:
Jasmin:20: Warning - Syntax error.
Jasmin:20: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:19: Warning - Syntax error.
Jasmin:19: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:25: Warning - Syntax error.
Jasmin:25: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:22: Warning - Syntax error.
Jasmin:22: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:21: Warning - Syntax error.
Jasmin:21: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:23: Warning - Syntax error.
Jasmin:23: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:26: Warning - Syntax error.
Jasmin:26: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
Jasmin:24: Warning - Syntax error.
Jasmin:24: Error - Couldn't repair and continue parse.
Jasmin: Found 2 errors
The text was updated successfully, but these errors were encountered: