[Wine-devel] Eter's patch is applied to winehq repo 06/11/13

builder-robot на etersoft.ru builder-robot на etersoft.ru
Вт Июн 11 23:40:20 MSK 2013


New Etersoft's patches since last build time:
commit aaed0e81d51678cbb43cdd4c1b774eaf1e4be71b
Author: Tatyana Fokina <tatyana на etersoft.ru>

    kernel32: Check the size of the string in CompareStringA.

commit 28951a0922fecbc10e1043dd32dd5241b074684e
Author: Tatyana Fokina <tatyana на etersoft.ru>

    kernel32/tests: Add test with a large string for CompareStringA.

---

commit aaed0e81d51678cbb43cdd4c1b774eaf1e4be71b
Author: Tatyana Fokina <tatyana на etersoft.ru>
Date:   Tue Jun 11 17:41:16 2013 +0400

    kernel32: Check the size of the string in CompareStringA.

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 86720ff..9ddf078 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2979,7 +2979,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
     WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
     WCHAR *buf2W = buf1W + 130;
     LPWSTR str1W, str2W;
-    INT len1W, len2W, ret;
+    INT len1W = 0, len2W = 0, ret;
     UINT locale_cp = CP_ACP;
 
     if (!str1 || !str2)
@@ -2994,7 +2994,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
 
     if (len1)
     {
-        len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
+        if (len1 <= 130) len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
         if (len1W)
             str1W = buf1W;
         else
@@ -3017,7 +3017,7 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
 
     if (len2)
     {
-        len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
+        if (len2 <= 130) len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
         if (len2W)
             str2W = buf2W;
         else
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index b6198d1..772d13b 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -1466,7 +1466,6 @@ static void test_CompareStringA(void)
     memset(a, 'a', sizeof(a));
     SetLastError(0xdeadbeef);
     ret = CompareStringA(lcid, 0, a, sizeof(a), a, sizeof(a));
-    todo_wine
     ok (GetLastError() == 0xdeadbeef && ret == CSTR_EQUAL,
         "ret %d, error %d, expected value %d\n", ret, GetLastError(), CSTR_EQUAL);
 }

commit 28951a0922fecbc10e1043dd32dd5241b074684e
Author: Tatyana Fokina <tatyana на etersoft.ru>
Date:   Tue Jun 11 17:35:19 2013 +0400

    kernel32/tests: Add test with a large string for CompareStringA.

diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index f1c66e2..b6198d1 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -1328,6 +1328,7 @@ static const struct comparestringa_entry comparestringa_data[] = {
 static void test_CompareStringA(void)
 {
   int ret, i;
+  char a[256];
   LCID lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT);
 
   for (i = 0; i < sizeof(comparestringa_data)/sizeof(struct comparestringa_entry); i++)
@@ -1461,6 +1462,13 @@ static void test_CompareStringA(void)
     todo_wine ok(ret == CSTR_LESS_THAN, "\'\\xB9\' character should be greater than \'a\'\n");
     ret = CompareStringA(lcid, 0, "\xB9", 1, "b", 1);
     ok(ret == CSTR_LESS_THAN, "\'\\xB9\' character should be smaller than \'b\'\n");
+
+    memset(a, 'a', sizeof(a));
+    SetLastError(0xdeadbeef);
+    ret = CompareStringA(lcid, 0, a, sizeof(a), a, sizeof(a));
+    todo_wine
+    ok (GetLastError() == 0xdeadbeef && ret == CSTR_EQUAL,
+        "ret %d, error %d, expected value %d\n", ret, GetLastError(), CSTR_EQUAL);
 }
 
 static void test_LCMapStringA(void)


Подробная информация о списке рассылки Wine-devel