-
Notifications
You must be signed in to change notification settings - Fork 5k
Convert.TryToHexString{Lower} does not check the length of destination correct #109807
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
Labels
Comments
Tagging subscribers to this area: @dotnet/area-system-runtime |
Would you like to investigate a bit? Edit: you already did. Would you like to offer a PR with a test? Thanks for the report |
This was referenced Nov 15, 2024
github-actions bot
pushed a commit
that referenced
this issue
Nov 27, 2024
The size of destination should not be less than double source's length. Fix #109807
GrabYourPitchforks
pushed a commit
that referenced
this issue
Dec 2, 2024
The size of destination should not be less than double source's length. Fix #109807
rbhanda
pushed a commit
that referenced
this issue
Dec 3, 2024
…0228) * Fix length check for Convert.TryToHexString{Lower} The size of destination should not be less than double source's length. Fix #109807 * Use stackalloc to create a Span * Use new char[] to instead potentially unbounded stackalloc --------- Co-authored-by: Universorum <[email protected]>
mikelle-rogers
pushed a commit
to mikelle-rogers/runtime
that referenced
this issue
Dec 10, 2024
The size of destination should not be less than double source's length. Fix dotnet#109807
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Description
Convert.TryToHexString{Lower} will allow the destination that smaller than actual length and will NOT allow what is bigger than 2x actual length.
Reproduction Steps
Expected behavior
The function may return
false
when the size of destination is smaller than 2x source and working when destination is bigger than 2x source.Actual behavior
The function will return
true
when the size of destination is smaller than 2x source with proper out variablecharsWritten
and will NOT working when destination is bigger than 2x source.Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
It look like 2 variable is reversed.
runtime/src/libraries/System.Private.CoreLib/src/System/Convert.cs
Line 3102 in 1c4c009
runtime/src/libraries/System.Private.CoreLib/src/System/Convert.cs
Line 3179 in 1c4c009
The text was updated successfully, but these errors were encountered: