这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@skvadrik
Copy link

DEX format allows Unicode space characters in SimpleName since version 040.
Allowed space characters include everything in Unicode category 'Zs':

0x20, 0xa0, 0x1680, 0x2000..0x200a, 0x202f, 0x205f, 0x3000

Smali now supports symtax method with spaces (spaces are allowed in
backtick-quoted names).

DEX format allows Unicode space characters in SimpleName since version 040.
Allowed space characters include everything in Unicode category 'Zs':

  0x20, 0xa0, 0x1680, 0x2000..0x200a, 0x202f, 0x205f, 0x3000

Smali now supports symtax `method with spaces` (spaces are allowed in
backtick-quoted names).
@skvadrik
Copy link
Author

Just to clarify, the change in DEX format is not in the android open-source tree yet, but it will land soon. I thought it would be nice if smali allowed to construct such names as well. Backtick syntax is borrowed from kotlin (see e.g. this issue for motivation).

@JesusFreke
Copy link
Owner

Thanks for the PR! I haven't taken a detailed look at the code yet, but 1 general comment is that the new syntax should only be enabled if smali is assembling a version 40 file. This is normally done by passing API level to smali via the -a option, so, assuming this is going into next year's release (R? 11?), I think that will likely end up being api.. 30?

That means, of course, we'll need to plumb the api level into the lexer, and dynamically enable that rule based on that

@skvadrik
Copy link
Author

@JesusFreke Right, this makes sense. I will amend the patch and resubmit. We can't be sure about the API version now, but 30 seems like a fair guess to me.

@Lanchon
Copy link
Contributor

Lanchon commented Aug 29, 2019 via email

@JesusFreke
Copy link
Owner

Yeah, that's a fair point. The quoting itself can be applicable to all versions, it's just the spaces in SimpleName that needs to be rejected on < 40

@Lanchon
Copy link
Contributor

Lanchon commented Aug 29, 2019

then maybe spaces whould be rejected during dex writing, which has access to dex version, and smali reading should be dex version agnostic.

@skvadrik
Copy link
Author

Updated the patch to check the API level. I added a new field to smaliFlexLexer (passed as an argument to constructor). In the test I pass level 10000 (the default magic constant for "future" level).

@skvadrik
Copy link
Author

@skvadrik
Copy link
Author

skvadrik commented Sep 5, 2019

@JesusFreke any followup on this? Is the updated patch better?

@JesusFreke
Copy link
Owner

JesusFreke commented Sep 14, 2019

Sorry for the delay, I was able to take a look at this today. I noticed that there are some issues around using quoted names in a class descriptor, e.g.

 L`java`/`lang`/`Object`;

I've started some work to expand on your initial implementation to better handle this case, and will likely get it finished and committed (including your 2 commits here) early next week.

Thanks!

@skvadrik
Copy link
Author

@JesusFreke great, thank you!

@JesusFreke
Copy link
Owner

This has been merged

thanks again!

@JesusFreke JesusFreke closed this Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants