-
-
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
InternalTypingException for Integer1Type #1071
Comments
@mbenz: I disagree with you that it should be an ´int`. In general the generated code is really looking strange:
We have an
However I wasn't able to get the app version you mentioned, therefore I don't know how the smali code looks. I also encountered this bug in a different app: com.google.android.youtube V14.06.56 in method BTW: Does anybody know what the |
@mbenz During a short talk with Steven I got enlighted about the reason of this problem: The problem "source" is Therefore the bug is located in the |
@jpstotz you're completely right. Seems that I was a bit hasty on proposing a reason for this issue :). As it turns out, we now know the underlying reason...always a good thing to have Steven around! |
Unfortunately in my case the problem is more complicated as I have code like this:
The problem is that |
@mbenz OK, another try to solve this issue. I found a similar version com.reddit.frontpage at apkmirror.com that triggers this problem. The big advantage of your sample is that it happens in the class ProxyCache, a class where we can get the source code. It turns out that the method triggering this issue consists of two methods on source code level, one seems to be inlined by the compiler:
The source of the problem is the assignment just at the beginning of the method:
I just started to dig into |
I think I now understand why soot is totally confused by this method. For understanding it is best to use the Jimple code before it has been processed by the LocalSplitter (the interesting part starts at
The important line is the last one:
However the try-catch section in this case also includes the blocks from This confuses the LocalSplitter when processing Therefore splitting of |
A short talk with Steven again explained a lot: The reason for this strange try-catch structure is the Android code verifier. Whenever a synchronized respectively enetermonitor/exitmonitor block is contained within a method it requires such a structure. This is because the code verifier's implementation is plain dead simple that it can not handle multiple blocks within a method and in the end verify that exitmonitor is always be called on all code paths. Therefore the folks at Google had decided that calling Soot has at the moment two classes that deal with such situations: Therefore from my perspective a final solution would be a new TrapTransformer to handle such cases:
After transforming the method the proposed way the LocalSplitter could successfully do it's work and split |
Wow! Thanks for the in-depth investigation, Jan! |
Originally I thought analyzing your issue case would help me on my issue, too (the com.google.android.youtube app) . And saving my thoughts to the issue tracker is a necessity for me to track the "current state" as I often get interrupted by other tasks. I tried to create a fix, but it is not that simple (especially when multiple synchronization blocks are contained in one method). At the moment my schedule does not leave much time to work on soot therefore I can't promise anything - sorry. |
I completely understand that and, unfortunately, have the same issues here... |
@jpstotz How can we handle for the below case:
Should the first catch handler include the statements from if "$u6 != 0 goto label03"(Since it is after the enter monitor statement); till exitmonitor $u3; in label 05 as that would be the last exit monitor statement. |
@pavanupb Looks like the compiler optimized the code and therefore the different blocks are not ordered in a way that would make it simple for us.
But then the block of One problem I can see is that the blocks of However I have to admit that I don't in detail what cases soot can or can not handle well. |
When jimplifying
com.reddit.frontpage-214190.apk
(Reddit v. 2.26.2), the following exception is thrown:This seems to occure because the
soot.jimple.toolkits.typing.integer.ClassHierarchy
does not have an entry for theInteger1Type
in itstypeNodeMap
. TheInteger1Type
origins from the cast expressiontmp$91006191 = ([0..1]) tmp$1547686471;
in the following body:I think the cast should rather be to
int
since the left side of the assignment is anint
andInteger1Type
is not a real type but seems to be some helper type.I'm not sure if the correct fix would be to adapt the
ClassHierarchy
to handle such special types asInteger1Type
or if the problem is rather that the cast should not have such a special type in the first place.@StevenArzt Have you seen this before? Any ideas?
The text was updated successfully, but these errors were encountered: