[vlc-devel] [PATCH] avcodec: Fix unprotected accessed to pts

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Oct 2 11:51:46 CEST 2019


On Wed, Oct 2, 2019, at 11:45 AM, Hugo Beauzée-Luyssen wrote:
> ---
>  modules/codec/avcodec/video.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index d69abd7419..b81d9a90de 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -702,7 +702,10 @@ static void Flush( decoder_t *p_dec )
>      decoder_sys_t *p_sys = p_dec->p_sys;
>      AVCodecContext *p_context = p_sys->p_context;
>  
> +    vlc_mutex_lock(&p_sys->lock);
>      date_Set(&p_sys->pts, VLC_TICK_INVALID); /* To make sure we 
> recover properly */
> +    vlc_mutex_unlock(&p_sys->lock);
> +
>      p_sys->i_late_frames = 0;
>      p_sys->framedrop = FRAMEDROP_NONE;
>      cc_Flush( &p_sys->cc );
> @@ -1339,7 +1342,10 @@ static int DecodeVideo( decoder_t *p_dec, 
> block_t *p_block )
>          p_sys->i_last_output_frame = -1;
>          p_sys->framedrop = FRAMEDROP_NONE;
>  
> +        vlc_mutex_lock(&p_sys->lock);
>          date_Set( &p_sys->pts, VLC_TICK_INVALID ); /* To make sure we 
> recover properly */
> +        vlc_mutex_unlock(&p_sys->lock);
> +
>          cc_Flush( &p_sys->cc );
>  
>          if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
> -- 

accesses*, fix locally

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list