Code Monkey home page Code Monkey logo

Comments (5)

 avatar commented on August 29, 2024

Are you changing heap.Name between calls to SetOffset() and WriteTo()? That will break the code since obviously SetOffset() must know the name in order to calculate its size.

if not, do you have a sample that triggers this condition?

from dnlib.

mazegen avatar mazegen commented on August 29, 2024

For example, if the reserved Flags value (ECMA-335 name) is not written, SetOffset expects 108 bytes to be written but only 106 bytes are actually written to the output although the code changes are valid:

SetOffset(...) {
....
//length += 4;   // Flags and Streams
length += 2;   // Streams only
...

;

WriteTo(...) {
...
//writer.Write((byte)(options.StorageFlags ?? 0));
//writer.Write(options.Reserved2 ?? 0);

I understand that almost noone modifies the header this way and I expect this behaviour to be resolved as "Won't Fix"; I just wanted to let you know.

from dnlib.

 avatar commented on August 29, 2024

You've modified the writer code so instead of writing StorageFlags,Reserved2,heaps.Count, you now only write heaps.Count? How does the CLR know this and correctly parses the new header without the 2 bytes before the heap count field? Is there a new flag I don't know about or forgot?

from dnlib.

mazegen avatar mazegen commented on August 29, 2024

The CLR can't parse it, I work on my own runtime. I should have mentioned it before.

from dnlib.

 avatar commented on August 29, 2024

This header will always be 4-byte aligned so there's only a problem if you change the size of the header so the heaps aren't 4-byte aligned, as you did in your modified code. I'll close this as a Won't-Fix 😎 but it should be trivial for you to fix it for your custom header.

from dnlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.