sharpfuzz icon indicating copy to clipboard operation
sharpfuzz copied to clipboard

"Error Calculating Max stack value."

Open Static-Flow opened this issue 2 years ago • 0 comments

Trying to use this on a html to pdf library (https://www.nuget.org/packages/IronPdf/) and got this error:

uname -a :

Linux 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

dotnet version : 8.0.100

sharpfuzz version:

Package Id                 Version      Commands
-------------------------------------------------
sharpfuzz.commandline      2.1.1        sharpfuzz
dnlib.DotNet.Writer.ModuleWriterException: Error calculating max stack value. If the method's obfuscated, set CilBody.KeepOldMaxStack or MetadataOptions.Flags (KeepOldMaxStack, global option) to ignore this error. Otherwise fix your generated CIL code so it conforms to the ECMA standard. Error occurred after metadata event BeginWriteMethodBodies during writing method 'System.Uri IronPdf.Engines.ErrorChecking::CheckBaseUri(System.Uri)' (0x0600050B).
   at dnlib.DotNet.DummyLogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args)
   at dnlib.DotNet.Writer.ModuleWriterBase.dnlib.DotNet.ILogger.Log(Object sender, LoggerEvent loggerEvent, String format, Object[] args)
   at dnlib.DotNet.Writer.Metadata.Error(String message, Object[] args)
   at dnlib.DotNet.Writer.Metadata.dnlib.DotNet.Writer.IWriterError.Error(String message)
   at dnlib.DotNet.Writer.MethodBodyWriter.ErrorImpl(String message)
   at dnlib.DotNet.Writer.MethodBodyWriterBase.Error(String message)
   at dnlib.DotNet.Writer.MethodBodyWriterBase.GetMaxStack()
   at dnlib.DotNet.Writer.MethodBodyWriter.Write()
   at dnlib.DotNet.Writer.Metadata.WriteMethodBodies()
   at dnlib.DotNet.Writer.Metadata.Create()
   at dnlib.DotNet.Writer.Metadata.CreateTables()
   at dnlib.DotNet.Writer.ModuleWriter.WriteImpl()
   at dnlib.DotNet.Writer.ModuleWriterBase.Write(Stream dest)
   at dnlib.DotNet.ModuleDef.Write(Stream dest, ModuleWriterOptions options)
   at SharpFuzz.Fuzzer.Instrument(ModuleDefMD src, Stream dst, Func`2 matcher, Boolean enableOnBranchCallback, TypeDef traceType) in /root/KashX/tools/fuzzing/sharpfuzz/src/SharpFuzz/Fuzzer.cs:line 144
   at SharpFuzz.Fuzzer.Instrument(String source, Func`2 matcher, Options options) in /root/KashX/tools/fuzzing/sharpfuzz/src/SharpFuzz/Fuzzer.cs:line 89
   at SharpFuzz.CommandLine.Program.Main(String[] args) in /root/KashX/tools/fuzzing/sharpfuzz/src/SharpFuzz.CommandLine/Program.cs:line 69
Failed to instrument the specified file, most likely because it's not a valid .NET assembly.

Any ideas? Looks like others have ran into this during decompilation and found solutions: https://stackoverflow.com/questions/58926381/setting-cilbody-keepoldmaxstack-or-metadataoptions-flags

Static-Flow avatar Dec 01 '23 00:12 Static-Flow