From: chenyu29 <[email protected]>

The sem_timedwait feature test passes an uninitialized pointer to
sem_init(), sem_timedwait() and sem_destroy(), which is undefined
behavior and may cause the test to crash or produce wrong results
on some platforms.

Use a stack-allocated sem_t and take its address instead.

Signed-off-by: chenyu29 <[email protected]>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 8f9fb04115..c02d2a1cfc 100755
--- a/configure
+++ b/configure
@@ -7182,7 +7182,7 @@ if ! disabled pthreads && ! enabled w32threads && ! 
enabled os2threads; then
     check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = 
PTHREAD_MUTEX_INITIALIZER"
 
     if enabled pthreads; then
-        check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
+        check_builtin sem_timedwait semaphore.h "sem_t s_val; sem_t *s = 
&s_val; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
         check_func pthread_cancel $pthreads_extralibs
         hdrs=pthread.h
         if enabled pthread_np_h; then
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to