md-5 / SpecialSource

Automatic generator and renamer of jar obfuscation mappings.
Other
206 stars 49 forks source link

Access-related bugfixes. #11

Closed Lrns123 closed 11 years ago

Lrns123 commented 11 years ago

The addition of access checks (private/static) has introduced two of bugs that result in SpecialSource only partially remapping jars, with obvious consequences.

The first bug involves the tryClimb function checking the access parameter. This parameter can be -1 if it cannot be deduced from the code (and this happens quite often). As Modifier.isPrivate and similar methods treat this as a bitmask, they all return true, thus aborting the inheritance lookup and not remapping the field or method, while in reality it should be.

The first commit solves this by skipping Modifier checks if access is equal to -1.

The second bug is caused by your reimplementation of the Remapper class. You've changed the class to pass along an access parameter to map functions, but since this introduces an API change, you've left a fallback method that just passes 0 as argument. Your use of the RemappingClassAdapter causes a problem, as your overriden methods call the superclass, which in turn call the old mapping methods. This causes the mapFieldName and mapMethodName functions to be called more often than necessary, and with invalid access information (namely, 0), which causes fields to be incorrectly renamed.

The second commit solves this by making a custom implementation of RemappingClassAdapter that extends ClassAdapter directly, but has your changes merged into it. This way, super calls ClassVisitor instead of asm's RemappingClassAdapter, solving the problems mentioned above.

tonybruess commented 11 years ago

:+1: nice work

md-5 commented 11 years ago

I love you

SuperSpyTX commented 11 years ago

Lrns123 is officially King for md_5's md_5 Loves the King Day!

tonybruess commented 11 years ago

Does this being merged fix #3 or #5?