[FFmpeg-devel] [PATCH] libswscale/swscale: initialize all dst plane pointers in sws_receive_slice()

James Almer jamrial at gmail.com
Tue Sep 7 16:06:37 EEST 2021


On 9/6/2021 12:01 PM, James Almer wrote:
> Fixes valgrind warnings about use of uninitialised values.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>   libswscale/swscale.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index c233818dcf..b9c9647fcb 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -1160,9 +1160,9 @@ int sws_receive_slice(struct SwsContext *c, unsigned int slice_start,
>           return ret;
>       }
>   
> -    for (int i = 0; i < FF_ARRAY_ELEMS(dst) && c->frame_dst->data[i]; i++) {
> -        dst[i] = c->frame_dst->data[i] +
> -                 c->frame_dst->linesize[i] * (slice_start >> c->chrDstVSubSample);
> +    for (int i = 0; i < FF_ARRAY_ELEMS(dst); i++) {
> +        ptrdiff_t offset = c->frame_dst->linesize[i] * (slice_start >> c->chrDstVSubSample);
> +        dst[i] = FF_PTR_ADD(c->frame_dst->data[i], offset);
>       }
>   
>       return scale_internal(c, (const uint8_t * const *)c->frame_src->data,

Applied.


More information about the ffmpeg-devel mailing list