http://bugs.winehq.org/show_bug.cgi?id=27177
Summary: advapi32: CRYPT_UnicodeToANSI use signed int for string size Product: Wine Version: unspecified Platform: x86 OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 AssignedTo: wine-bugs@winehq.org ReportedBy: menone7@gmail.com
CRYPT_UnicodeToANSI use signed int for string size. It problem, if size is negative. WideCharToMultiByte does not always work out well if count < 0. example /dlls/advapi32/tests/crypt.c:560
http://bugs.winehq.org/show_bug.cgi?id=27177
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com 2011-08-03 17:29:17 CDT --- What's a problem exactly? WideCharToMultiByte takes signed int for buffer size.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #2 from Alexandex Yastrebov menone7@gmail.com 2011-08-03 20:21:49 CDT --- The problem is that some functions pass DWORD(unsigned int) as buffer size, accepted from the application, but should correctly handle values like 0xdeadbeaf. Example CryptEnumProvidersA. WideCharToMultiByte however not obliged to correctly handle a negative buffer size.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #3 from Dmitry Timoshkov dmitry@baikal.ru 2011-08-04 00:58:27 CDT --- Please provide a simple use case to demonstrate the problem.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #4 from Alexandex Yastrebov menone7@gmail.com 2011-08-04 04:50:15 CDT --- I'm found bugs in ReactOS with wine tests http://www.reactos.org/testman/detail.php?id=2537184. If buffer size is a 0xdeadbeaf, ReactOS WideCharToMultiByte fail. Also Windows realization of WideCharToMultiByte. If Wine realization not fail, it a problem of Wine.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #5 from Dmitry Timoshkov dmitry@baikal.ru 2011-08-04 09:03:00 CDT --- (In reply to comment #4)
I'm found bugs in ReactOS with wine tests http://www.reactos.org/testman/detail.php?id=2537184. If buffer size is a 0xdeadbeaf, ReactOS WideCharToMultiByte fail. Also Windows realization of WideCharToMultiByte. If Wine realization not fail, it a problem of Wine.
Please provide a test case (preferably as a part of Wine test suite) to show that's a real Wine problem and not something not related (like a bug in ReactOS).
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #6 from Alexandex Yastrebov menone7@gmail.com 2011-08-04 11:17:04 CDT --- http://test.winehq.org/data/89dcf229d05d20ee17aff5712d59ba30efe0d1a9/linux_a... When these bugs will be fixed, errors will be occur the same as that of ReactOS. Wait.
http://bugs.winehq.org/show_bug.cgi?id=27177
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|advapi32 |-unknown OS/Version|All |other
--- Comment #7 from Dmitry Timoshkov dmitry@baikal.ru 2011-08-04 11:38:57 CDT --- (In reply to comment #6)
http://test.winehq.org/data/89dcf229d05d20ee17aff5712d59ba30efe0d1a9/linux_a... When these bugs will be fixed, errors will be occur the same as that of ReactOS. Wait.
This sounds like a pure speculation.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #8 from Dmitry Timoshkov dmitry@baikal.ru 2011-08-04 11:43:22 CDT --- (In reply to comment #7)
(In reply to comment #6)
http://test.winehq.org/data/89dcf229d05d20ee17aff5712d59ba30efe0d1a9/linux_a... When these bugs will be fixed, errors will be occur the same as that of ReactOS. Wait.
This sounds like a pure speculation.
Moreover that claim could be interpreted that there is no any bug in Wine.
http://bugs.winehq.org/show_bug.cgi?id=27177
--- Comment #9 from Alexandex Yastrebov menone7@gmail.com 2011-08-04 20:35:13 CDT --- This code should work incorrectly even in Wine, but it's the same bug, signed int != DWORD.
char* prov = "Microsoft Base Cryptographic Provider v1.0"; DWORD cbProvName = 0xFFFFFFFF; /* -1 See http://source.winehq.org/source/dlls/advapi32/crypt.c#L130 */ DWORD dwProvType; char szProvName[128]; CryptEnumProvidersA(0, NULL, 0, &dwProvType, szProvName, &cbProvName);
ok(!strcmp(szProvName, prov), "expected %s, got %s\n", prov, szProvName);
http://bugs.winehq.org/show_bug.cgi?id=27177
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |dank@kegel.com Resolution| |INVALID
--- Comment #10 from Dan Kegel dank@kegel.com 2011-08-05 01:33:37 CDT --- Does this affect any real apps? The test case fragment you gave seems buggy, as you're advertising a longer buffer than is really present.
Marking invalid for now. We can reopen if there's evidence that real apps depend on this.
http://bugs.winehq.org/show_bug.cgi?id=27177
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #11 from Austin English austinenglish@gmail.com 2011-08-08 15:19:53 CDT --- Closing.