[mono] Use unsigned char when computing UTF8 string hashes#21632
Merged
akoeplinger merged 1 commit intomono:mainfrom Mar 13, 2023
Merged
[mono] Use unsigned char when computing UTF8 string hashes#21632akoeplinger merged 1 commit intomono:mainfrom
unsigned char when computing UTF8 string hashes#21632akoeplinger merged 1 commit intomono:mainfrom
Conversation
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes dotnet/runtime#82187 Fixes dotnet/runtime#78638
Member
Author
|
/backport to 2020-02 |
Contributor
|
Started backporting to 2020-02: https://github.com/mono/mono/actions/runs/4392747411 |
vargaz
approved these changes
Mar 11, 2023
akoeplinger
approved these changes
Mar 13, 2023
ThomasKuehne
pushed a commit
to ThomasKuehne/mono
that referenced
this pull request
Mar 23, 2024
) Backport of dotnet/runtime#83273 to mono/mono `main` The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Contributes to dotnet/runtime#82187 Contributes to dotnet/runtime#78638
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of dotnet/runtime#83273 to mono/mono
mainThe C standard does not specify whether
charis signed or unsigned, it is implementation defined.Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results).
Mono uses
mono_metadata_str_hashin the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device.Contributes to dotnet/runtime#82187
Contributes to dotnet/runtime#78638