[vlc-commits] [Git][videolan/vlc][master] emscripten: ensure the vlc_thread_id() contract is matched

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Oct 9 13:01:29 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
a781992f by Steve Lhomme at 2021-10-09T12:44:33+00:00
emscripten: ensure the vlc_thread_id() contract is matched

We can't use vlc_thread_id() safely if the value is truncated. Different
threads might end up with the same ID.

- - - - -


1 changed file:

- src/emscripten/thread.c


Changes:

=====================================
src/emscripten/thread.c
=====================================
@@ -23,8 +23,10 @@
 #endif
 
 #include <pthread.h>
+#include <assert.h>
 
 unsigned long vlc_thread_id(void)
 {
+    static_assert(sizeof(pthread_t) <= sizeof(unsigned long),"invalid pthread_t size");
     return pthread_self();
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a781992ff132389dcf5feeb7dee602fd4b2d3510

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a781992ff132389dcf5feeb7dee602fd4b2d3510
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list