Fix qRound(inf) assert
In some extreme cases we can return a finite float, and then turn it infinite when multiplying it to calculate the index positions. Avoid the whole thing by clamping to a brightness of +-32768 times the white point standard, which is well within current HDR standards. Credit to OSS-Fuzz which detected the assert. Pick-to: 6.8 Change-Id: If007732a8d59ea27514f17674d318a099a057281 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 2b7ecfab7d8cb149ffc02285906f95906f2f1343) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
093ab48adf
commit
a692c8a78d
@ -56,7 +56,8 @@ public:
|
||||
if (x < m_d)
|
||||
return m_c * x + m_f;
|
||||
float t = std::pow(m_a * x + m_b, m_g);
|
||||
if (std::isfinite(t))
|
||||
// Avoid NaN math, and leave room to multiply with 65280 and store in an int.
|
||||
if (std::isfinite(t) && t > std::numeric_limits<short>::min() && t < std::numeric_limits<short>::max())
|
||||
return t + m_e;
|
||||
if (t > 0.f)
|
||||
return 1.f;
|
||||
|
Loading…
x
Reference in New Issue
Block a user