Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Shouldn't escape namespace #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CreateAndInject
Copy link

No description provided.

@0xd4d
Copy link
Contributor

0xd4d commented Jun 8, 2020

Can you explain a little more why this is needed and what it fixes?

@CreateAndInject
Copy link
Author

Type.Name=TypeDef.ReflectionName
Type.FullName=TypeDef.ReflectionFullName
But Type.Namespace=TypeDef.Namespace, it means Type.Namespace doesn't escape any char.
So:

namespace te&st
{
    class Fo&rm1 : Form
    {
      //..........
    }
}

This type requests resource te&st.Fo\&rm1.resources rather than te\&st.Fo\&rm1.resources

The following test work fine, but it wont run after de4dot, this PR can fix it.
test.zip

@CreateAndInject
Copy link
Author

@de4dot de4dot deleted a comment from altoms Jun 12, 2020
@0xd4d
Copy link
Contributor

0xd4d commented Jun 15, 2020

There are two GetManifestResourceStream() methods, one with a Type+string and the other one with a string arg. How can you be sure the 2nd one with only a string arg is never called?

@CreateAndInject
Copy link
Author

CreateAndInject commented Jun 16, 2020

I think it isn't relative to this PR.
If old code work with GetManifestResourceStream(string), my PR work also.
This PR doesn't take any side effect, if you don't think so, can you give me a test which old code work fine but this PR doesn't work.

@0xd4d
Copy link
Contributor

0xd4d commented Jun 26, 2020

Your code changes something that's used by all deobfuscators, so unless you can show that that other overload is never called by them, this PR could break other code.

@CreateAndInject
Copy link
Author

GetManifestResourceStream(string name) requires name with a .resources postfix, which de4dot doesn't support originally.
de4dot supports ResourceManager(string baseName, Assembly assembly), and this PR still supports it.
So, I don't think it's a breaking change, since it doesn't break any correct output.

@CreateAndInject
Copy link
Author

Related issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants