[FFmpeg-devel] avdevice/decklink: Fix seg fault in decklink

Marton Balint cus at passwd.hu
Tue Dec 18 01:40:29 EET 2018

On Mon, 17 Dec 2018, BIGLER Don (Framatome) wrote:

> Attached is a patch that fixes a potential segmentation fault in 
> avdevice/decklink when used in a multi-threaded environment outside of 
> ffmpeg.  Because the capture_started flag is not set the stream is not 
> closed properly.  This can cause a segmentation fault when the input 
> callback is called in a multi-threaded reader that has not stopped 
> reading before the connection is closed.

It might be better just to call the cleanup functions unconditonally in 
ff_decklink_read_close if ctx->dli is not null, e.g.:

     if (ctx->dli) {

Input format autodetection can start the stream long before you added the 
capture_started line.


More information about the ffmpeg-devel mailing list