Commit fada6a1c authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen Committed by Qt Cherry-pick Bot

Fix division by zero

Consider a zero we need to divide with illegal input.

Fixes oss-fuzz 29347

Change-Id: I2aae1d765d2dd81c95d423038ef5cb878d4f8026
Reviewed-by: default avatarRobert Löhning <robert.loehning@qt.io>
(cherry picked from commit 16b8d766)
Reviewed-by: default avatarQt Cherry-pick Bot <cherrypick_bot@qt-project.org>
parent 86af1842
......@@ -524,6 +524,8 @@ bool parseTRC(const QByteArray &data, const TagEntry &tagEntry, QColorTrc &gamma
return false;
std::array<quint32_be, 3> parameters =
qFromUnaligned<decltype(parameters)>(data.constData() + parametersOffset);
if (parameters[1] == 0)
return false;
float g = fromFixedS1516(parameters[0]);
float a = fromFixedS1516(parameters[1]);
float b = fromFixedS1516(parameters[2]);
......@@ -537,6 +539,8 @@ bool parseTRC(const QByteArray &data, const TagEntry &tagEntry, QColorTrc &gamma
return false;
std::array<quint32_be, 4> parameters =
qFromUnaligned<decltype(parameters)>(data.constData() + parametersOffset);
if (parameters[1] == 0)
return false;
float g = fromFixedS1516(parameters[0]);
float a = fromFixedS1516(parameters[1]);
float b = fromFixedS1516(parameters[2]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment