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

Fixes #16359 - correctly handle imports with 0 length public key tokens #16363

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

KevinRansom
Copy link
Member

@KevinRansom KevinRansom commented Nov 30, 2023

Description

When the F# compiler imported an assembly, if the assembly had a publickey token record that was empty, I.e a 0 length Public key record, it treated the assembly as having a public key. When we subsequently wrote an assembly reference to this assembly, we would add a public key made up of a garbage value. This particular form is not usually produced by MS compilers and so it has escaped detection, however, some obfuscation programs when obfuscating signed assemblies will make the assembly unsigned by zeroing out the public key record length rather than the public key address. This change to the compiler ensures that when we import types we treat references to 0 length public keys as if there was no public key.

Fixes #16359

@KevinRansom KevinRansom requested a review from a team as a code owner November 30, 2023 22:21
@T-Gro T-Gro merged commit 1af023b into dotnet:main Dec 1, 2023
T-Gro added a commit that referenced this pull request Dec 4, 2023
* Fixes #16359 - correctly handle imports with 0 length public key tokens (#16363)

* Parser: recover on unfinished record decls, fix field ranges (#16357)

* Parser: recover on unfinished record decls, fix field ranges

* Fantomas

* Better diagnostic ranges for fields

* More parser tests

* Update surface area

* Fix xml doc test

* Update baselines

* Update src/Compiler/SyntaxTree/SyntaxTree.fsi

Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>

* Add MutableKeyword to SynFieldTrivia. (#11)

* Simplify

* Fantomas

---------

Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com>

---------

Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
Co-authored-by: Eugene Auduchinok <eugene.auduchinok@jetbrains.com>
Co-authored-by: Edgar Gonzalez <edgargonzalez.info@gmail.com>
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
@nojaf nojaf mentioned this pull request Dec 14, 2023
3 tasks
@nojaf nojaf mentioned this pull request Dec 29, 2023
3 tasks
@nojaf nojaf mentioned this pull request Jan 31, 2024
3 tasks
@KevinRansom KevinRansom mentioned this pull request Aug 6, 2024
@jsoref jsoref mentioned this pull request Aug 21, 2024
3 tasks
@KevinRansom KevinRansom mentioned this pull request Sep 9, 2024
3 tasks
@mmitche mmitche mentioned this pull request Sep 11, 2024
3 tasks
@psfinaki psfinaki mentioned this pull request Feb 10, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error when refencing an F# project from a C# project
3 participants