Opened 11 years ago
#3579 new defect
Uses pthread_cond_init() are unchecked
Reported by: | Cigaes | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
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.
Note:
See TracTickets
for help on using tickets.