Washi1337 / OldRod

An automated KoiVM disassembler and devirtualisation utility
GNU General Public License v3.0
345 stars 80 forks source link

`Neg` OpCode is not supported. #46

Closed ElektroKill closed 2 years ago

ElektroKill commented 2 years ago

Describe the bug KoiVM converts the CIL Neg OpCode into two different expressions depending on the type.

To Reproduce Devirtualize sample file provided for issue #44.

Expected behavior The Neg OpCode should be emitted for both of the aforementioned expressions.

Screenshots Example of 'obfuscated' Neg: image

Washi1337 commented 2 years ago

Note: This is most likely supposed to be done on IL Ast level, as it is just a special case of the normal a - b operation:

https://github.com/Washi1337/OldRod/blob/6773f8dcc780efae20722fe3242d7afc6144d564/src/OldRod.Core/Ast/IL/Transform/LogicSimplifier.cs#L104

Washi1337 commented 2 years ago

By the way, the provided sample does not have a test case for R4 and R8. Could you maybe upload one?

ElektroKill commented 2 years ago

Sure, here is a new version of the original sample which includes two new additional methods with test cases for R4 and R8. sample-new.zip