src: Fix possible heap-use-after free for OpenSSL global locking
This is simply programming error, but it is interesting that using libstdc++ does not reveal this error. With clang++-libc++, we got std::system_error: mutex lock faild: Invalid argument. This is because we did not give a name to lock object, so it is immediately destructed. I think this will fix the reported crash on Mac OSX.
This commit is contained in:
parent
0d4120ce2c
commit
8fffa05513
|
@ -812,7 +812,7 @@ int main(int argc, char **argv)
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
|
|
||||||
#ifndef NOTHREADS
|
#ifndef NOTHREADS
|
||||||
ssl::LibsslGlobalLock();
|
ssl::LibsslGlobalLock lock;
|
||||||
#endif // NOTHREADS
|
#endif // NOTHREADS
|
||||||
|
|
||||||
auto ssl_ctx = SSL_CTX_new(SSLv23_client_method());
|
auto ssl_ctx = SSL_CTX_new(SSLv23_client_method());
|
||||||
|
|
|
@ -296,7 +296,7 @@ int main(int argc, char **argv)
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
#ifndef NOTHREADS
|
#ifndef NOTHREADS
|
||||||
ssl::LibsslGlobalLock();
|
ssl::LibsslGlobalLock lock;
|
||||||
#endif // NOTHREADS
|
#endif // NOTHREADS
|
||||||
|
|
||||||
reset_timer();
|
reset_timer();
|
||||||
|
|
|
@ -1621,7 +1621,7 @@ int main(int argc, char **argv)
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
#ifndef NOTHREADS
|
#ifndef NOTHREADS
|
||||||
nghttp2::ssl::LibsslGlobalLock();
|
nghttp2::ssl::LibsslGlobalLock lock;
|
||||||
#endif // NOTHREADS
|
#endif // NOTHREADS
|
||||||
|
|
||||||
if(conf_exists(get_config()->conf_path.get())) {
|
if(conf_exists(get_config()->conf_path.get())) {
|
||||||
|
|
Loading…
Reference in New Issue