Commit 8fffa055 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

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.
parent 0d4120ce
...@@ -812,7 +812,7 @@ int main(int argc, char **argv) ...@@ -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) ...@@ -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) ...@@ -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())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment