[FFmpeg-devel] [PATCH] avcodec/dpx: check for possible buffer overreads

Michael Niedermayer michael at niedermayer.cc
Fri Feb 12 21:47:46 EET 2021


On Fri, Feb 12, 2021 at 12:00:17AM +0100, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavcodec/dpx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
> index 5372e3d586..68a2762017 100644
> --- a/libavcodec/dpx.c
> +++ b/libavcodec/dpx.c
> @@ -606,6 +606,9 @@ static int decode_frame(AVCodecContext *avctx,
>  
>      ff_set_sar(avctx, avctx->sample_aspect_ratio);
>  
> +    if (buf_size - offset < (((uint64_t)elements * avctx->width * avctx->height * bits_per_color) >> 3))
> +        return AVERROR_INVALIDDATA;

looks reasonable, i did not check that this is exactly correct for all
cases though

thx

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20210212/a6f2e24f/attachment.sig>


More information about the ffmpeg-devel mailing list