-
Notifications
You must be signed in to change notification settings - Fork 43
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
pthread_mutex_unlock doesn't check whether arguments is NULL for windows, this may cause dos #623
Comments
What real runtime scenario (without modifying code) are you seeing the message_processing_context->mutex is NULL? AFAICT, it should be impossible for message_processing_context->mutex to be NULL because it would have caused the call to See the code in I suppose one could check if the mutex is NULL before trying to lock, but what do you propose it should do if it is NULL? continuing without locking is not an option. The best I can think of is to exit the process because the invariant condition is that the mutex should have been initialized during the ADUC_D2C_Messaging_Init(), so a crash is a good thing to make it discoverable with a stack trace in a crash dump--it would mean the initialization was not called, which is bad, or something else set the mutex to NULL (also bad). |
check
as you can see, |
Thanks. It makes sense that this could happen during process shutdown given the order of uninit. |
Draf PR is available here: #696 |
description
according to https://github.com/coapp-packages/pthreads/blob/master/pthread_mutex_unlock.c, it doesn't check whether the
*mutex
is NULL, and access `mutex directly. This will cause crash because of invalid memory access.The use of pthread_mutex_unlock in this project doesn't check it. I compiled it in windows, and get a crash in
d2c_messaging.c:DefaultIoTHubSendReportedStateCompletedCallback
whilemessage_processing_context->mutex
is NULL.The text was updated successfully, but these errors were encountered: