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 issue with ToString and numeric value #1853

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CLR/CorLib/corlib_native_System_Number.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ int Library_corlib_native_System_Number::Format_D(
// printf and ToString differs on negative numbers:
// printf("%05d", -123) returns "-0123"
// -123.ToString("D5") returns "-00123"
if (precision != 0 && ret > 1 && buffer[0] == '-')
if (precision != 0 && ret > 1 && precision >= ret && buffer[0] == '-')
{
// our buffer defined bigger than the max number string, no worries
memmove(&buffer[2], &buffer[1], ret);
Expand Down