Here is the problematic input video attached.
On Mon, Dec 12, 2022 at 3:08 PM Drew Dunne wrote:
> Previously I sent this patch to solve an overflow in these templates. That
> patch wasn't used in favor of one that biased the output calculations to
> avoid the double clipping. Now
Previously I sent this patch to solve an overflow in these templates. That
patch wasn't used in favor of one that biased the output calculations to
avoid the double clipping. Now I've found an underflow case, which I've put
the command below, and I'll attach an input image in a reply.
./ffmpeg \
lex
> "scale=flags=bicubic+full_chroma_int+full_chroma_inp+bitexact+accurate_rnd:in_color_matrix=bt2020:out_color_matrix=bt2020:in_range=full:out_range=full,format=rgba64[out]"
> -pixel_format rgba64 -map '[out]' -y overflow_w66h64.png
>
> Found-by: Drew
Avoid a possible integer overflow in the yuv2rgba64 templates by using
av_sat_add32 when combing the R, G, B components with Y. On certain
inputs, this addition can overflow to a negative, is then clipped to a
power of two and shifted down 14. This results in a much different value
in the output th
---
libswscale/output.c | 96 ++---
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/libswscale/output.c b/libswscale/output.c
index 0e1c1225a0..8c8f62682a 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1109,20 +1109,20 @@ yuv2