Commit 9739cae4 authored by Marc Mutz's avatar Marc Mutz
Browse files

QRawFont: fix UB (misaligned load) in fontTable()


Found by UBSan:

  qrawfont.cpp:618:60: runtime error: load of misaligned address 0x2acee92a5569 for type 'const quint32', which requires 4 byte alignment

Fix by using MAKE_TAG(), like everywhere else, instead
of a load through a type-punned and misaligned pointer.

Change-Id: I52b88ca05a57f7d8c5e5bce953384de49514079b
Reviewed-by: default avatarKonstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: default avatarLars Knoll <lars.knoll@theqtcompany.com>
Showing with 1 addition and 2 deletions
...@@ -607,8 +607,7 @@ QByteArray QRawFont::fontTable(const char *tagName) const ...@@ -607,8 +607,7 @@ QByteArray QRawFont::fontTable(const char *tagName) const
if (!d->isValid()) if (!d->isValid())
return QByteArray(); return QByteArray();
const quint32 *tagId = reinterpret_cast<const quint32 *>(tagName); return d->fontEngine->getSfntTable(MAKE_TAG(tagName[0], tagName[1], tagName[2], tagName[3]));
return d->fontEngine->getSfntTable(qToBigEndian(*tagId));
} }
/*! /*!
......
Supports Markdown
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