[vlc-devel] Concurrency problem in modules/misc/qte_main.cpp

Justus-bulk at Piater.name Justus-bulk at Piater.name
Fri Sep 19 13:15:28 CEST 2008


Hi,

This file contains the following code:


static qte_thread_t * p_qte_main = NULL;
...
static int Open( vlc_object_t *p_this )
{
    vlc_mutex_t *lock;

    lock = var_AcquireMutex( "qte" );
    ...
    p_qte_main = (qte_thread_t *) vlc_object_create( p_this, sizeof(qte_thread_t) );
    ...
    vlc_mutex_unlock( lock );

    vlc_object_attach( p_qte_main, p_this );
    ...
}


The value of p_qte_main is used after the mutex is released. This
means that another thread might reassign it in the meantime (e.g., by
calling this same function), causing a vlc_object_attach() on the
wrong object.

I guess the proper fix is to switch these two lines of code.

Would someone who can actually test this code check in a patch?

Thanks,
Justus



More information about the vlc-devel mailing list