[PATCH 0/2] MR2351: kernel32: Fix ANSI formatting regressions.
When len is zero (to obtain the length needed), nothing is written to `output`, even though the rewrite (correctly) uses WideCharToMultiByte on the output to determine the returned length. But this leads to reading garbage uninitialized values instead of the proper value. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2351
From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Fixes a regression introduced by b6bf69ef804146f81b803719a72d8c6afde184ba. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/kernel32/locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 16aa0bdd2aa..9d7b7924c77 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -455,9 +455,9 @@ int WINAPI GetNumberFormatA( LCID lcid, DWORD flags, const char *value, fmt.NegativeOrder = format->NegativeOrder; fmt.lpDecimalSep = fmt_decimal; fmt.lpThousandSep = fmt_thousand; - ret = GetNumberFormatW( lcid, flags, input, &fmt, output, len ); + ret = GetNumberFormatW( lcid, flags, input, &fmt, output, ARRAY_SIZE(output) ); } - else ret = GetNumberFormatW( lcid, flags, input, NULL, output, len ); + else ret = GetNumberFormatW( lcid, flags, input, NULL, output, ARRAY_SIZE(output) ); if (ret) ret = WideCharToMultiByte( cp, 0, output, -1, buffer, len, 0, 0 ); return ret; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2351
From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Fixes a regression introduced by 42afb693b10dee9a06fcadb204560490a24f1754. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/kernel32/locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 9d7b7924c77..bf936c2e7f5 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -511,9 +511,9 @@ int WINAPI GetCurrencyFormatA( LCID lcid, DWORD flags, const char *value, fmt.lpDecimalSep = fmt_decimal; fmt.lpThousandSep = fmt_thousand; fmt.lpCurrencySymbol = fmt_symbol; - ret = GetCurrencyFormatW( lcid, flags, input, &fmt, output, len ); + ret = GetCurrencyFormatW( lcid, flags, input, &fmt, output, ARRAY_SIZE(output) ); } - else ret = GetCurrencyFormatW( lcid, flags, input, NULL, output, len ); + else ret = GetCurrencyFormatW( lcid, flags, input, NULL, output, ARRAY_SIZE(output) ); if (ret) ret = WideCharToMultiByte( cp, 0, output, -1, buffer, len, 0, 0 ); return ret; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2351
participants (1)
-
Gabriel Ivăncescu