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>
(cherry picked from commit 3d500e62f6
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -842,7 +842,8 @@ rgb_to_xy(double rc,
|
|||||||
*z = m[2][0] * rc + m[2][1] * gc + m[2][2] * bc;
|
*z = m[2][0] * rc + m[2][1] * gc + m[2][2] * bc;
|
||||||
|
|
||||||
sum = *x + *y + *z;
|
sum = *x + *y + *z;
|
||||||
|
if (sum == 0)
|
||||||
|
sum = 1;
|
||||||
*x = *x / sum;
|
*x = *x / sum;
|
||||||
*y = *y / sum;
|
*y = *y / sum;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user