[FFmpeg-trac] #3579(undetermined:new): Uses pthread_cond_init() are unchecked

FFmpeg trac at avcodec.org
Mon Apr 21 12:11:15 CEST 2014

#3579: Uses pthread_cond_init() are unchecked
               Reporter:  Cigaes     |                  Owner:
                   Type:  defect     |                 Status:  new
               Priority:  minor      |              Component:
                Version:  git-       |  undetermined
  master                             |               Keywords:
             Blocked By:             |               Blocking:
Reproduced by developer:  0          |  Analyzed by developer:  0
 Normal Unix implementations should not fail, since they could be done
 statically with {{{PTHREAD_COND_INITIALIZER}}}, but w32 compat
 implementation, at least, has a malloc in it and could fail in case of
 OOM. If that happens, the calling program will be dereferencing NULL or
 random memory. This, of course, can not be reproduced at will.

 $ git grep 'pthread_cond_init(&' -- $(git grep -l w32pthreads)
 pthread_cond_init(&c->task_fifo_cond, NULL);
 pthread_cond_init(&c->finished_task_cond, NULL);
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->input_cond,
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->progress_cond,
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->output_cond,
 libavcodec/pthread_slice.c:    pthread_cond_init(&c->current_job_cond,
 libavcodec/pthread_slice.c:    pthread_cond_init(&c->last_job_cond, NULL);
 pthread_cond_init(&p->progress_cond[i], NULL);
 libavfilter/pthread.c:    pthread_cond_init(&c->current_job_cond, NULL);
 libavfilter/pthread.c:    pthread_cond_init(&c->last_job_cond,    NULL);

 Uses of {{{pthread_mutex_init()}}} are also unchecked, but AFAICS they
 should not be able to fail.

Ticket URL: <https://trac.ffmpeg.org/ticket/3579>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list