summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-06-05 19:54:45 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-06-08 18:00:05 +0200
commit3d500e62f6206ad11308b18976246366aed8c1a5 (patch)
treeb84e2cd1525463627349ffd5efdbb748b5fc7cd7
parentca9025f374e4c4632a8a1be623304b78ba6435f6 (diff)
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@niedermayer.cc>
-rw-r--r--libavfilter/vf_ciescope.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavfilter/vf_ciescope.c b/libavfilter/vf_ciescope.c
index b3b906f517..cafdb915ea 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;
}