Some unicode characters are considered equivalent for filename purposes on mac.
This adds logic to treat these collisions the same way as case sensitivy
collisions are currently handled -- by adding a numeric suffix to the
file/directory anytime there is a collision.
See pull request #789 for more information.
Starting from JFlex 1.8.0, `yychar` is a long.
However, it is used to build an antlr `CommonToken` which takes an int.
Hence, explicit casting is needed.
I propose to cast the `yychar` with `java.lang.Math.toIntExact()` which throw an ArithmeticException in case of overflow.
This is acceptable because the previous code would have returned an overflowed (negative) position.
See https://github.com/jflex-de/jflex/pull/605 for details.
Previously, if you needed to provide a custom dex file rewriter, you
would have to override the DexRewriter class. This provides a more
consistent interface, allowing the dex file rewriter to be specified in
the module.
This adds a new rewriteUnwrappedType to the TypeRewriter class, which
gets called with the unwrapped type for array types, with the potentially
modified return value automatically being re-array-ified.
It was mis-lexing the case when a class descriptor is immediately
followed by a primitive type. The primitive type was being lexed as
PARAM_LIST_OR_ID_PRIMITIVE_TYPE instead of PRIMITIVE_TYPE.
The root cause was due to an incorrect state change. Since the
CLASS_DESCRIPTOR state can be started from within the PARAM_LIST state,
but when the CLASS_DESCRIPTOR state ends it just went back to YYINITIAL,
instead of going back to PARAM_LIST.
This adds a state stack to track these state changes
This unifies the handling of simple names between class descriptors and
member names, and ensures that spaces are only allowed for the appropriate
api levels in both cases
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).
In api 28, the vdex files in, e.g. the framework/arm directory are actually
just sym links to a shared vdex file in the framework directory. However,
the sym links use an absolute path, and so they don't resolve correctly in
the loop mounted system image.
As a simple workaround, we'll just search upward one directory in the path
if the vdex file can't be resolved.
Oat version 138 introduced the concept of an "uncompressed" dex file, where
the dex file is listed in the oat file, but it's not actually present in
the oat or vdex files, instead, it's in the apk as per usual.
This change makes dexlib2 ignore these files, treating them as if they are
not a part of the oat file.
Newer versions of art seem to use ! instead of : to separate the
inner dex filename from the name of the container containing it.
e.g.
/system/framework/framework.jar!classes2.dex
instead of
/system/framework/framework.jar:classes2.dex
Loading cdex files is mostly supported, except for the new debug info
structures.
Dumping is somewhat supported, but only when there's a single cdex file
in the vdex.