-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
ILReader gets implicit conversions subtly wrong #901
Comments
We should test with programs like this:
Does the addition always overflow when use_native_int==false? Or only on 32-bit systems? |
But if I comment out the
This means the presence of the Ecma-335 claims:
So I guess this is just another case where the spec is just plain wrong. |
The code in this gist demonstrates that the .NET runtime behavior depends on whether the runtime can detect a piece of code is unreachable at byte-code parse-time. (remove the comment from the stloc/ldloc pair to change the behavior of the program when executed with 64-bit .NET framework). |
With this fix we still only propagate type information along forward branches, so some of the issues in #901 remain.
The fix I just pushed keeps the However, the other aspects of the original issue are still a problem. |
The plan here is to rewrite the In summary, we need the same "reimport" process as the .NET runtime: we need to be able to import a block multiple times as we learn more about its input stack types. This rewrite should also use the same "reachable code only" approach as the .NET runtime. Optionally (if "removed dead code" option is used) we could even constant-fold simple conditional branches (like .NET does), which would significantly increase our ability to understand obfuscated code. |
Ecma-335 Partition III 1.6 Implicit argument coercion, Table 9: Signature Matching shows the possible implicit conversions possible in IL.
Issues with our current implementation:
We don't explicitly model starting/stopping GC tracking. This might cause assertions in the decompiler due to mismatched types.Fixed in 9a829a2.Currently we emit a warning and an inconsistent ILAst, which then causes assertions due to mismatched types. (e.g. in the compiler-generatedWe have a workaround that tends to work for C++/CLI-generated code, but isn't correct in general._onexit_m
method in C++/CLI console apps)The text was updated successfully, but these errors were encountered: