http://bugs.winehq.org/show_bug.cgi?id=59926 Bug ID: 59926 Summary: kernelbase: CharPrevA/CharPrevExA crash on NULL start pointer (MapleStory 216150 fails to launch) Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: kernel32 Assignee: wine-bugs@list.winehq.org Reporter: f0rm4tm3@gmail.com Distribution: --- MapleStory (Steam app 216150) fails to launch under Wine: the process crashes with an access violation (0xc0000005) during startup. Root cause: CharPrevA() and CharPrevExA() in dlls/kernelbase/string.c dereference the start pointer in their loop condition without a NULL guard: LPSTR WINAPI CharPrevExA(WORD codepage, const char *start, const char *ptr, DWORD flags) { while (*start && (start < ptr)) /* crashes when start == NULL */ The game passes a NULL start pointer at launch, triggering the crash. CharPrevA() has the same bug. Suggested fix: return NULL early when start is NULL, matching how other kernelbase string helpers (e.g. StrChrA) already handle NULL input: if (!start) return NULL; while (*start && (start < ptr)) ... Reproduce: 1. Steam -> MapleStory (216150) under any recent Wine/Proton. 2. Launch -> process crashes at startup (0xc0000005 in kernelbase, inside CharPrevExA). Patch: two commits attached as git format-patch files (git am them): 1. kernelbase/tests: Add tests for CharPrevA. 2. kernelbase: Don't dereference NULL in CharPrevA/CharPrevExA. (I would have opened a merge request, but my gitlab.winehq.org account is awaiting validation and cannot fork; attaching the patch here instead.) -- 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.