Skip to content
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

Unknown error in dnlib, while Encrypting resources #12

Closed
kirsan31 opened this issue Aug 13, 2018 · 5 comments
Closed

Unknown error in dnlib, while Encrypting resources #12

kirsan31 opened this issue Aug 13, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@kirsan31
Copy link

kirsan31 commented Aug 13, 2018

Describe the bug
Unknown error in dnlib (see log below), while Encrypting resources, but not every time. Sometimes all ok, but target app become corrupted (not run at all). Original ConfuserEx with same config work well.

To Reproduce
See #12 (comment)

Expected behavior
No error.

Log

[DEBUG] Encrypting resources...
[ERROR] Unknown error occurred.
Exception: dnlib.DotNet.Writer.ModuleWriterException: Target instruction is too far away for a short branch. Use the long branch or call CilBody.SimplifyBranches() and CilBody.OptimizeBranches()
at dnlib.DotNet.DummyLogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args) in C:\projects\neo-confuserex\dnlib\src\DotNet\ILogger.cs:line 456
at dnlib.DotNet.Writer.MetaData.dnlib.DotNet.Writer.IWriterError.Error(String message) in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MetaData.cs:line 2575
at dnlib.DotNet.Writer.MethodBodyWriterBase.WriteShortInlineBrTarget(BinaryWriter writer, Instruction instr) in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MethodBodyWriterBase.cs:line 360
at dnlib.DotNet.Writer.MethodBodyWriterBase.WriteInstructions(BinaryWriter writer) in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MethodBodyWriterBase.cs:line 118
at dnlib.DotNet.Writer.MethodBodyWriter.WriteFatHeader() in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MethodBodyWriter.cs:line 144
at dnlib.DotNet.Writer.MethodBodyWriter.Write() in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MethodBodyWriter.cs:line 97
at dnlib.DotNet.Writer.MetaData.WriteMethodBodies() in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MetaData.cs:line 1552
at dnlib.DotNet.Writer.MetaData.Create() in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\MetaData.cs:line 1206
at dnlib.DotNet.Writer.ModuleWriter.WriteImpl() in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\ModuleWriter.cs:line 171
at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest) in C:\projects\neo-confuserex\dnlib\src\DotNet\Writer\ModuleWriterBase.cs:line 503
at Confuser.Core.ConfuserEngine.WriteModule(ConfuserContext context) in C:\projects\neo-confuserex\Confuser.Core\ConfuserEngine.cs:line 393
at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action1 func, Func1 targets, ConfuserContext context) in C:\projects\neo-confuserex\Confuser.Core\ProtectionPipeline.cs:line 135
at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context) in C:\projects\neo-confuserex\Confuser.Core\ConfuserEngine.cs:line 244
at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in C:\projects\neo-confuserex\Confuser.Core\ConfuserEngine.cs:line 175
Failed at 13:45, 0:04 elapsed.

@kirsan31 kirsan31 changed the title Unknown error in dnlib, while Encrypting resources, on first run only. Unknown error in dnlib, while Encrypting resources Aug 13, 2018
@XenocodeRCE
Copy link
Owner

@kirsan31 can you share sample file ? I cannot reproduce the issue

@XenocodeRCE XenocodeRCE added the bug Something isn't working label Aug 13, 2018
@kirsan31
Copy link
Author

@XenocodeRCE
I have several app and only with one of them have this problem. I will try to compile test binary to reproduce this...

@kirsan31
Copy link
Author

kirsan31 commented Aug 14, 2018

Did it: tst.zip
image

You need to press "protect" button until error will happen (in my case it from 1 to 8 protections).
And yes, even if protection complete well from 1 run, the confused app will crush with this error in event log:

error:

Application: tst.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message:
Stack:
at System.Environment.FailFast(System.String)
at .‍‏‬‏‫‍‪‍‫‬‎‌‮‪​‌‍‪‪‎‫‫‮(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart(System.Object)

So, it's 2 bugs in 1?

@kirsan31
Copy link
Author

kirsan31 commented Sep 6, 2018

@XenocodeRCE Any news?

@matthias-hoste
Copy link

Any news/progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants