Francois Gouget : oleaut32: VarParseNumFromStr() does not allow leading thousands separators.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 07:30:23 CST 2022


Module: wine
Branch: oldstable
Commit: 014c114a2866b610bf8b663f9e2f721ee309f1b2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=014c114a2866b610bf8b663f9e2f721ee309f1b2

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jul 22 00:03:47 2021 +0200

oleaut32: VarParseNumFromStr() does not allow leading thousands separators.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit de70f7289e23e895956927e7e3ce2ed23a188e77)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/oleaut32/tests/vartest.c | 4 ++--
 dlls/oleaut32/variant.c       | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index 575a04bb8e4..7aaec0ef80a 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -1605,7 +1605,7 @@ static void test_VarParseNumFromStrEn(void)
 
   /* With flag, but leading thousands separators are not allowed */
   CONVERT(",1,000", NUMPRS_THOUSANDS);
-  todo_wine EXPECTFAIL;
+  EXPECTFAIL;
 
   /* With flag, thousands separator not needed but still reported */
   CONVERT("1,", NUMPRS_THOUSANDS);
@@ -1982,7 +1982,7 @@ static void test_VarParseNumFromStrFr(void)
 
   /* With flag, but leading thousands separators are not allowed */
   CONVERT(" 1 000", NUMPRS_THOUSANDS);
-  todo_wine EXPECTFAIL;
+  EXPECTFAIL;
 
   /* With flag, thousands separator not needed but still reported */
   CONVERT("1 ", NUMPRS_THOUSANDS|NUMPRS_USE_ALL);
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index c76656d25a6..f3fa5d64caf 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1651,6 +1651,12 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
         lpszStr++;
       } while (iswspace(*lpszStr));
     }
+    else if (pNumprs->dwInFlags & NUMPRS_THOUSANDS &&
+             ((chars.cDigitSeparator && *lpszStr == chars.cDigitSeparator) ||
+              (cDigitSeparator2 && *lpszStr == cDigitSeparator2)))
+    {
+      return DISP_E_TYPEMISMATCH; /* Not allowed before the first digit */
+    }
     else if (pNumprs->dwInFlags & NUMPRS_LEADING_PLUS &&
              *lpszStr == chars.cPositiveSymbol &&
              !(pNumprs->dwOutFlags & NUMPRS_LEADING_PLUS))




More information about the wine-cvs mailing list