summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-03-10 09:53:36 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-03-15 10:39:24 +0000
commit9739cae4c84218e1a805bbd82b2f40fe20d57b74 (patch)
tree0d9248ad7c2b2eb15c2d0f86ea62688a1f2e09f8 /src/gui
parentadd95c55108dcda46286846dae5ad12d6ee9057b (diff)
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: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qrawfont.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 0fd5f510c7..59f13581dd 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -607,8 +607,7 @@ QByteArray QRawFont::fontTable(const char *tagName) const
if (!d->isValid())
return QByteArray();
- const quint32 *tagId = reinterpret_cast<const quint32 *>(tagName);
- return d->fontEngine->getSfntTable(qToBigEndian(*tagId));
+ return d->fontEngine->getSfntTable(MAKE_TAG(tagName[0], tagName[1], tagName[2], tagName[3]));
}
/*!