Incorrect buffer size check in Convert.TryToHexString / Convert.TryToHexStringLower #110094
Labels
needs-area-label
An area label is needed to ensure this gets routed to the appropriate area owners
Description
Affected methods:
Convert.TryToHexString(ReadOnlySpan<byte>, Span<char>, out int)
Convert.TryToHexStringLower(ReadOnlySpan<byte>, Span<char>, out int)
Problem:
The expression
destination.Length > source.Length * 2
in both implementations should have inverted comparison operator.runtime/src/libraries/System.Private.CoreLib/src/System/Convert.cs
Lines 3097 to 3106 in 940e395
runtime/src/libraries/System.Private.CoreLib/src/System/Convert.cs
Lines 3174 to 3183 in 940e395
Reproduction Steps
Expected behavior
Actual behavior
Regression?
No response
Known Workarounds
Ensure
destination.Length == source.Length * 2
before calling the affected methods.Configuration
.NET Runtime 9.0.0
Other information
No response
The text was updated successfully, but these errors were encountered: