#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)
 libavcodec/frame_thread_encoder.c:
 pthread_cond_init(&c->task_fifo_cond, NULL);
 libavcodec/frame_thread_encoder.c:
 pthread_cond_init(&c->finished_task_cond, NULL);
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->input_cond,
 NULL);
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->progress_cond,
 NULL);
 libavcodec/pthread_frame.c:        pthread_cond_init(&p->output_cond,
 NULL);
 libavcodec/pthread_slice.c:    pthread_cond_init(&c->current_job_cond,
 NULL);
 libavcodec/pthread_slice.c:    pthread_cond_init(&c->last_job_cond, NULL);
 libavcodec/pthread_slice.c:
 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
_______________________________________________
FFmpeg-trac mailing list
[email protected]
http://avcodec.org/mailman/listinfo/ffmpeg-trac

Reply via email to