Fix named mutex PAL test issue (#62655)
The issue seems to be caused by a bug in the test. The problematic call to `TestCreateMutex` is passed `nullptr` as the `name` parameter. It then calls `convert` helper on it to convert it to wide char. However, the `convert` helper doesn't check whether it is `nullptr` or not and ends up returning a pointer to a memory with possibly random data, that is returned by `malloc(0)`. The returned pointer is then passed to the CreateMutex PAL api that probably ends up attempting to get the length of the name or something. And depending on the random data, it sometimes fails. The fix is to change the `convert` function to handle `nullptr` so that it returns `nullptr` too.
Showing
想要评论请 注册 或 登录