[FFmpeg-devel] [PATCH] libavfilter: avoid UB nullptr-with-offset.

Michael Niedermayer michael at niedermayer.cc
Thu Feb 18 00:45:53 EET 2021


On Tue, Feb 16, 2021 at 03:53:08PM +0000, Jeremy Leconte wrote:
> ---
>  libavfilter/vf_scale.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 58eee96744..98cef5eb4b 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -631,7 +631,7 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s
>      int in_stride[4],out_stride[4];
>      int i;
>  
> -    for (i=0; i<4; i++) {
> +    for (i=0; i<4 && cur_pic->data[i] != NULL; i++) {
>          int vsub= ((i+1)&2) ? scale->vsub : 0;
>           in_stride[i] = cur_pic->linesize[i] * mul;
>          out_stride[i] = out_buf->linesize[i] * mul;

This leaves parts of the array uninitialized 
Ill fix this (unless someone else does before me)

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- 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/20210217/e8631306/attachment.sig>


More information about the ffmpeg-devel mailing list