[FFmpeg-devel] [PATCH 2/4] avcodec/cbs: Check ctx for NULL in ff_cbs_flush()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat Oct 29 22:32:24 EEST 2022


Michael Niedermayer:
> Fixes: null pointer dereference
> Fixes: 52155/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-5760107527143424
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavcodec/cbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
> index 504197e06d..9d59403f13 100644
> --- a/libavcodec/cbs.c
> +++ b/libavcodec/cbs.c
> @@ -120,7 +120,7 @@ av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr,
>  
>  av_cold void ff_cbs_flush(CodedBitstreamContext *ctx)
>  {
> -    if (ctx->codec->flush)
> +    if (ctx && ctx->codec->flush)
>          ctx->codec->flush(ctx);
>  }
>  

The check should be in the dts2pts bsf instead.

- Andreas



More information about the ffmpeg-devel mailing list