[FFmpeg-devel] [PATCH 3/4] avformat/mxfdec: Ensure klv->key is initialized

Tomas Härdin git at haerdin.se
Wed Jul 23 23:02:36 EEST 2025


ons 2025-07-23 klockan 13:45 +0200 skrev Michael Niedermayer:
> Fixes: read of uninitialized memory
> Fixes: 391916474/clusterfuzz-testcase-minimized-
> ffmpeg_dem_MXF_fuzzer-4935250956845056
> 
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavformat/mxfdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 0eed13d850d..184e97256cd 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -491,7 +491,9 @@ static int klv_read_packet(MXFContext *mxf,
> KLVPacket *klv, AVIOContext *pb)
>          return AVERROR_INVALIDDATA;
>  
>      memcpy(klv->key, mxf_klv_key, 4);
> -    avio_read(pb, klv->key + 4, 12);
> +    int ret = ffio_read_size(pb, klv->key + 4, 12);
> +    if (ret < 0)
> +        return ret;

ret != 12 is better. If it's non-negative then return AVERROR_EOF

/Tomas


More information about the ffmpeg-devel mailing list