Skip to content

"Error Calculating Max stack value." #54

@Static-Flow

Description

@Static-Flow

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions