-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix named mutex PAL test issue #62655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
9b8433b to
68c008c
Compare
trylek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, fixing tests is often equally or more challenging than fixing the actual runtime behavior, thanks Jan for figuring this out!
The issue seems to be caused by a bug in the test. The problematic call
to
TestCreateMutexis passednullptras thenameparameter. Itthen calls
converthelper on it to convert it to wide char. However,the
converthelper doesn't check whether it isnullptror not andends up returning a pointer to a memory with possibly random data,
that is returned by
malloc(0). The returned pointer is then passed tothe 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
convertfunction to handlenullptrso thatit returns
nullptrtoo.Close #62336