[x264-devel] Possible data race bug

Paul Thomson pault543 at gmail.com
Mon Jan 7 18:05:32 CET 2013


Hi,

I am working with an old version of x264. I am benchmarking techniques
for automatically finding bugs in multithreaded programs. I have come
across a data race which may be a bug. The sequence of events is as
follows. There are two threads. I have used 912 and 720 for the
addresses of the two x264_t structures.

x264_encoder_encode(h=720)
x264_thread_sync_context(dest=912, source=720)
create_thread(..., h=912)
x264_encoder_frame_end(h=720, current=912, ...)
x264_encoder_encode(h=720)
x264_thread_sync_context(dest=720, source=912)

At this point, the second thread executes:
x264_slice_write(h=912)

x264_thread_sync_context reads from source->stat.frame while
x264_slice_write writes to h->stat.frame (to all 0s). This is a
read-write data race.

Is this a bug?

It looks like this can still happen in the latest version. Is this the case?

If so, would it just lead to a less-optimised encoding (as opposed to
corruption)?

Would this lead to non-deterministic results?

Thanks,
Paul


More information about the x264-devel mailing list