-
-
Notifications
You must be signed in to change notification settings - Fork 713
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
ThrowableSet.catchableAs(...) can be incorrect in case option no_bodies_for_excluded == true #1060
Comments
I agree that Classes can be phantom since you might not have a class source for them, eventually rendering all of its methods as phantom as well. The case where you want to exclude only a few methods of a class but not all is not modeled within Soot. We might consider renaming the I am not quite sure how phantom classes are able to have a correct type hierarchy... How does Soot build the type hierarchy for classes with no class source? |
For a real phantom class Soot can not build a class hierarchy (in such a case is The following is partially an assumption based on the outcome I have seen and my general reverse engineering skill how developers usually think: Situation: A library class that is excluded by the default exclude list is loaded and resolved for the level |
I see. I misread that this is about library classes... Could we just extend the check in |
That would be an option if a real phantom class would only have a resolved level of I am not that deep into the Soot phantom class generation to know if this is true or not. Regarding the BTW: I noticed that the class |
Unfortunately this bug can't be solved that simple. I just changed the implementation to check for Both tests use "phantom exceptions" which are created this way : This creates a phantom class that has resolving level Therefore the only chance I currently see is to use the |
Instead of isPhantom() we now use !hasSuperclass() || "java.lang.Object".equals(sootClass.getName())
OK, I implemented the check that bases on superClass instead of isPhantomClass. I also changed the other methods of Any comments of pull request #1073 are welcome. |
Instead of isPhantom() we now use !hasSuperclass() || "java.lang.Object".equals(sootClass.getName())
If you call
ThrowableSet.catchableAs(exceptionType)
using an exception that is not a basic class and not an application class the result will be incorrect.Background: In case the Soot option
no_bodies_for_excluded == true
andinclude_all == false
Soot will load most of the library classes (from rt.jar or android.jar) and mark them as phantom class if they come from a package that is excluded by default (see Scene.determineExcludedPackages()).The method
ThrowableSet.catchableAs(..)
checks if a class is phantom and if it is phantom it does not perform the type check which ends up in incorrect results. I assume the person who wrote the catchableAs method assumed that phantom classes do not have a valid type hierarchy and therefore can't be checked.However the "phantom library classes" do have a correct type hierarchy!
BTW: Alternatively there is the solution to say that the option
no_bodies_for_excluded
does not work correctly as it's name would suggest (or is there a documentation of this flag?) because it marks the whole class phantom instead of only marking the methods as phantom (which is what I would have expected by it's name). Also the default not-modifiable exclude list inScene.java
is IMHO not a very clean solution.The text was updated successfully, but these errors were encountered: