[FFmpeg-devel] [PATCH 05/14] avcodec/ffv1dec: Fix data races emanating from copying whole context

Michael Niedermayer michael at niedermayer.cc
Sun Apr 25 15:21:49 EEST 2021


On Sat, Apr 24, 2021 at 01:14:37PM +0200, Andreas Rheinhardt wrote:
> When using frame threading, the FFV1 decoder's update_thread_context()
> function copies the whole context and afterwards restores some allocated
> fields with backups made earlier. Among these fields are the
> ThreadFrames and the source context's ThreadFrames can change
> concurrently without any synchronization, leading to data races which
> are undefined behaviour even if they don't lead to problems in
> practice (as the destination's own ThreadFrames are restored directly
> thereafter).
> 
> Fix this by only copying the actually needed fields.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/ffv1dec.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)

LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210425/f9a03d09/attachment.sig>


More information about the ffmpeg-devel mailing list