[FFmpeg-cvslog] avfilter/vf_ciescope: Fix undefined behavior in rgb_to_xy() with black

Michael Niedermayer git at videolan.org
Fri Jun 18 22:15:02 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jun  5 19:54:45 2021 +0200| [42ae2836527e04e2fbab884cf971987a154b897f] | committer: Michael Niedermayer

avfilter/vf_ciescope: Fix undefined behavior in rgb_to_xy() with black

Fixes: floating point division by 0
Fixes: undefined behavior in handling NaN
Fixes: Ticket 8268

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 3d500e62f6206ad11308b18976246366aed8c1a5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42ae2836527e04e2fbab884cf971987a154b897f
---

 libavfilter/vf_ciescope.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_ciescope.c b/libavfilter/vf_ciescope.c
index 719e66ad0f..2ddec3d06b 100644
--- a/libavfilter/vf_ciescope.c
+++ b/libavfilter/vf_ciescope.c
@@ -849,7 +849,8 @@ rgb_to_xy(double rc,
     *z = m[2][0] * rc + m[2][1] * gc + m[2][2] * bc;
 
     sum = *x + *y + *z;
-
+    if (sum == 0)
+        sum = 1;
     *x = *x / sum;
     *y = *y / sum;
 }



More information about the ffmpeg-cvslog mailing list