From 8ace8e879050fbfc7e11c68541dbadd6ce8b56a9 Mon Sep 17 00:00:00 2001 From: Shreesh Adiga <16567adigashreesh@gmail.com> Date: Sun, 11 Jul 2021 18:13:04 +0530 Subject: demux: acquire lock before calling update_bytes_read in->byte_level_seeks field is written and modified inside update_bytes_read at the same time when demux_get_reader_state is executing, which locks the demux thread mutex. This results in a data race, reported by Thread Sanitizer when playing mp3 file of sufficient long length. --- demux/demux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demux') diff --git a/demux/demux.c b/demux/demux.c index 650078d068..fdec805d15 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -4137,10 +4137,10 @@ static void update_cache(struct demux_internal *in) stream_control(stream, STREAM_CTRL_GET_METADATA, &stream_metadata); } - update_bytes_read(in); - pthread_mutex_lock(&in->lock); + update_bytes_read(in); + if (do_update) in->stream_size = stream_size; if (stream_metadata) { -- cgit v1.2.3