rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
885 stars 209 forks source link

pthread_setname_np could be called before pthread_create sets m_thread #184

Open tbodt opened 5 years ago

tbodt commented 5 years ago

https://github.com/rakshasa/libtorrent/blob/7b29b6bd2547e72e22b9b7981df27092842d2a10/src/torrent/utils/thread_base.cc#L126

This can run before pthread_create has initialized m_thread. When this happens, pthread_setname_np is called with a null pointer, which results in a segfault.