[Bug 37759] New: GetStringTypeW: Access violation when src param is null
https://bugs.winehq.org/show_bug.cgi?id=37759 Bug ID: 37759 Summary: GetStringTypeW: Access violation when src param is null Product: Wine Version: 1.7.33 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs(a)winehq.org Reporter: christian.faurebouvard(a)gmail.com Distribution: --- The function GetStringTypeW in kernel32, at locale.c (line 2460) cause an access violation when the src param is null and count>0 In windows, it return 0 (false) on this condition, i've patched locale.c at line 2482 with this code: if (count > 0 && !src){ SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } Problem detected when trying to run a CLARION 8 application. After this patch, the app seem running OK, with a firebird database via unixodbc. Thanks. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 Sebastian Lackner <sebastian(a)fds-team.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian(a)fds-team.de --- Comment #1 from Sebastian Lackner <sebastian(a)fds-team.de> --- Thanks for reporting this issue. As you already have figured out how to fix it, do you mind sending a patch on the wine-patches mailing list? Take a look here for more information: http://wiki.winehq.org/SubmittingPatches If possible also add a corresponding patch to the wine test suite (dlls/kernel32/tests), to ensure that the behaviour matches Windows as good as possible. If you're not interested or don't have time I can also take a look at it myself. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #2 from christian faure <christian.faurebouvard(a)gmail.com> --- Thanks Sebastian, Ok, i will try to learn the wine patch mechanism, and build the corresponding patches. If i fail to do this correctly, then inform you shortly... Best regards PD: i'm very impressed how many apps can work with wine. Great job! Thanks! -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #3 from christian faure <christian.faurebouvard(a)gmail.com> --- Created attachment 50297 --> https://bugs.winehq.org/attachment.cgi?id=50297 [1/1] kernel32: Fix GetStringTypeW when src param is null GetStringTypeW: return 0 (FALSE) when src param is null. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #4 from Sebastian Lackner <sebastian(a)fds-team.de> --- The new code added in your patch mixes spaces and tabs, which should probably be fixed before the submission to wine-patches(a)winehq.org. If possible also look at the corresponding test suite. There are already existing tests for this functio, and your special case could be easily added. See dlls/kernel32/tests/locale.c, function test_GetStringTypeW. Something like: BOOL res; /* test with src = NULL and count = 0 */ SetLastError(0xdeadbeef); memset(types,0,sizeof(types)); res = GetStringTypeW(CP_CTYPE1, NULL, 0, types); ok(!res, "GetStringTypeW unexpectedly succeeded\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error, got %u\n", GetLastError()); /* test with src = NULL and count != 0 */ SetLastError(0xdeadbeef); memset(types,0,sizeof(types)); res = GetStringTypeW(CP_CTYPE1, NULL, 10, types); ok(!res, "GetStringTypeW unexpectedly succeeded\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error, got %u\n", GetLastError()); Thanks for your effort :) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #5 from christian faure <christian.faurebouvard(a)gmail.com> --- Thanks, tomorrow i will change the configuration of editor to replace tabs by space and regenerate the patch and try to build/run the test suite. The test suite is a bit more complicated, but the code you provided is helpful to learn how it work. Thanks -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 christian faure <christian.faurebouvard(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #50297|0 |1 is obsolete| | --- Comment #6 from christian faure <christian.faurebouvard(a)gmail.com> --- Created attachment 50300 --> https://bugs.winehq.org/attachment.cgi?id=50300 [1/1] kernel32: Fix GetStringTypeW when src param is null Replace previous patch, replace tabs by spaces and include proposed changes for test suite -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #7 from Bruno Jesus <00cpxxx(a)gmail.com> --- (In reply to christian faure from comment #6)
Created attachment 50300 [details] [1/1] kernel32: Fix GetStringTypeW when src param is null
I can see just a minor inconsistency in the style, the loop instead of: for(i = -1; i<3; i++){ Should be: for(i = -1; i < 3; i++) { And: memset(types,0,sizeof(types)); To: memset(types, 0, sizeof(types)); The file is not following a 80 column rule so there is no need to split the ok() line. I have also posted your patch in the testbot [1] to check if this is the correct behavior in all Windows versions. [1] https://testbot.winehq.org/JobDetails.pl?Key=10890 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #8 from christian faure <christian.faurebouvard(a)gmail.com> --- Thanks Bruno, i'm beginer with this... Ok, it have styles problems, and, if necesary, i will replace the patch. But, in testbot we can see: On build section: ...trailing whitespace... ...error: while searching for:... ...Patch failed to apply And on others sections (tests): No log, task skipped All of the problems are caused by trailing whitespaces? And about the messages "No log, task skiped", it indicates untested because the patch was not applied? or the test is bad? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #9 from Bruno Jesus <00cpxxx(a)gmail.com> --- I see that the patch failed to build, that is probably a problem in my end since I used Windows to do it =) I'll try again at home unless someone else retries it first. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #10 from Bruno Jesus <00cpxxx(a)gmail.com> --- All tests ran without problems. https://testbot.winehq.org/JobDetails.pl?Key=10903 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #11 from christian faure <christian.faurebouvard(a)gmail.com> --- Thanks Bruno. Next time i will observe the style for coding patches. Merry Christmas. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 --- Comment #12 from Nikolay Sivov <bunglehead(a)gmail.com> --- Hi, Christian. Just a reminder, are you going to resubmit this patch any time soon or you're not longer interested in this? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |9cffed782fd447445d4de213948 | |15bf944e507f1 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #13 from Nikolay Sivov <bunglehead(a)gmail.com> --- Fixed with 9cffed782fd447445d4de21394815bf944e507f1. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|GetStringTypeW: Access |CLARION 8 crashes on null |violation when src param is |pointer in GetStringTypeW |null | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=37759 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #14 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 1.7.44. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
wine-bugs@winehq.org