Add error message on unaligned profile inputs
Pick-to: 5.15 Task-number: QTBUG-84267 Change-Id: I7ec2100455bd0178cdff0de2d24abbe6c19f812f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>bb10
parent
cdfafec01b
commit
dddd0c3ad8
|
|
@ -666,6 +666,9 @@ QByteArray QColorSpace::iccProfile() const
|
|||
If the ICC profile is not supported an invalid QColorSpace is returned
|
||||
where you can still read the original ICC profile using iccProfile().
|
||||
|
||||
\note If the QByteArray data is created from external sources it should be
|
||||
at least 4 byte aligned.
|
||||
|
||||
\sa iccProfile()
|
||||
*/
|
||||
QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile)
|
||||
|
|
|
|||
|
|
@ -614,6 +614,11 @@ bool parseDesc(const QByteArray &data, const TagEntry &tagEntry, QString &descNa
|
|||
|
||||
bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
|
||||
{
|
||||
Q_ASSERT((reinterpret_cast<qintptr>(data.constData()) & 0x3) == 0);
|
||||
if (reinterpret_cast<qintptr>(data.constData()) & 0x3) {
|
||||
qCWarning(lcIcc) << "fromIccProfile: Unaligned profile data";
|
||||
return false;
|
||||
}
|
||||
if (data.size() < qsizetype(sizeof(ICCProfileHeader))) {
|
||||
qCWarning(lcIcc) << "fromIccProfile: failed size sanity 1";
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue