[FFmpeg-devel] [PATCH] swscale/utils: disable full_chr_h_input optimization for odd width

Michael Niedermayer michael at niedermayer.cc
Tue Dec 3 02:18:28 EET 2024


Hi Niklas

On Mon, Dec 02, 2024 at 01:14:09PM +0100, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> The basic problem here is that the rgb*ToUV_half_* functions hard-code a
> bilinear downsample from src[i] + src[i+1], with no bounds check on the i+1
> access.
> 
> Due to the signature of the function, we cannot easily plumb the "true" width
> into the function body to perform a bounds check. Similarly, we cannot easily
> pre-pad the input because it is typically reading from the original input
> frame, which would require a full memcpy to pad. Either of these solutions are
> more trouble than the feature is worth, so just disable it on odd input sizes.
> 
> Fixes: use of uninitialized value
> Fixes: ticket #11265
> Signed-off-by: Niklas Haas <git at haasn.dev>
> Sponsored-by: Sovereign Tech Fund
> ---
>  libswscale/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The input generally should be padded, but teh padding may not have been
initialized or may contain things next to the frame being scaled.

The patch is probably ok

thx

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- 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/20241203/48e547dc/attachment.sig>


More information about the ffmpeg-devel mailing list