mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 09:23:03 +08:00
parent
6abb43bde5
commit
830f86fb30
119
ports/qtbase/CVE-2023-43114-6.5.patch
Normal file
119
ports/qtbase/CVE-2023-43114-6.5.patch
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp
|
||||||
|
index 44cc7fe63e..e44d85a3cb 100644
|
||||||
|
--- a/src/gui/text/windows/qwindowsfontdatabase.cpp
|
||||||
|
+++ b/src/gui/text/windows/qwindowsfontdatabase.cpp
|
||||||
|
@@ -873,36 +873,70 @@ QT_WARNING_POP
|
||||||
|
return fontEngine;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static QList<quint32> getTrueTypeFontOffsets(const uchar *fontData)
|
||||||
|
+static QList<quint32> getTrueTypeFontOffsets(const uchar *fontData, const uchar *fileEndSentinel)
|
||||||
|
{
|
||||||
|
QList<quint32> offsets;
|
||||||
|
- const quint32 headerTag = *reinterpret_cast<const quint32 *>(fontData);
|
||||||
|
+ if (fileEndSentinel - fontData < 12) {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
+ return offsets;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ const quint32 headerTag = qFromUnaligned<quint32>(fontData);
|
||||||
|
if (headerTag != MAKE_TAG('t', 't', 'c', 'f')) {
|
||||||
|
if (headerTag != MAKE_TAG(0, 1, 0, 0)
|
||||||
|
&& headerTag != MAKE_TAG('O', 'T', 'T', 'O')
|
||||||
|
&& headerTag != MAKE_TAG('t', 'r', 'u', 'e')
|
||||||
|
- && headerTag != MAKE_TAG('t', 'y', 'p', '1'))
|
||||||
|
+ && headerTag != MAKE_TAG('t', 'y', 'p', '1')) {
|
||||||
|
return offsets;
|
||||||
|
+ }
|
||||||
|
offsets << 0;
|
||||||
|
return offsets;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ const quint32 maximumNumFonts = 0xffff;
|
||||||
|
const quint32 numFonts = qFromBigEndian<quint32>(fontData + 8);
|
||||||
|
- for (uint i = 0; i < numFonts; ++i) {
|
||||||
|
- offsets << qFromBigEndian<quint32>(fontData + 12 + i * 4);
|
||||||
|
+ if (numFonts > maximumNumFonts) {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Font collection of" << numFonts << "fonts is too large. Aborting.";
|
||||||
|
+ return offsets;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (quintptr(fileEndSentinel - fontData) > 12 + (numFonts - 1) * 4) {
|
||||||
|
+ for (quint32 i = 0; i < numFonts; ++i)
|
||||||
|
+ offsets << qFromBigEndian<quint32>(fontData + 12 + i * 4);
|
||||||
|
+ } else {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
}
|
||||||
|
+
|
||||||
|
return offsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void getFontTable(const uchar *fileBegin, const uchar *data, quint32 tag, const uchar **table, quint32 *length)
|
||||||
|
+static void getFontTable(const uchar *fileBegin, const uchar *fileEndSentinel, const uchar *data, quint32 tag, const uchar **table, quint32 *length)
|
||||||
|
{
|
||||||
|
- const quint16 numTables = qFromBigEndian<quint16>(data + 4);
|
||||||
|
- for (uint i = 0; i < numTables; ++i) {
|
||||||
|
- const quint32 offset = 12 + 16 * i;
|
||||||
|
- if (*reinterpret_cast<const quint32 *>(data + offset) == tag) {
|
||||||
|
- *table = fileBegin + qFromBigEndian<quint32>(data + offset + 8);
|
||||||
|
- *length = qFromBigEndian<quint32>(data + offset + 12);
|
||||||
|
- return;
|
||||||
|
+ if (fileEndSentinel - data >= 6) {
|
||||||
|
+ const quint16 numTables = qFromBigEndian<quint16>(data + 4);
|
||||||
|
+ if (fileEndSentinel - data >= 28 + 16 * (numTables - 1)) {
|
||||||
|
+ for (quint32 i = 0; i < numTables; ++i) {
|
||||||
|
+ const quint32 offset = 12 + 16 * i;
|
||||||
|
+ if (qFromUnaligned<quint32>(data + offset) == tag) {
|
||||||
|
+ const quint32 tableOffset = qFromBigEndian<quint32>(data + offset + 8);
|
||||||
|
+ if (quintptr(fileEndSentinel - fileBegin) <= tableOffset) {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ *table = fileBegin + tableOffset;
|
||||||
|
+ *length = qFromBigEndian<quint32>(data + offset + 12);
|
||||||
|
+ if (quintptr(fileEndSentinel - *table) < *length) {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
}
|
||||||
|
+ } else {
|
||||||
|
+ qCWarning(lcQpaFonts) << "Corrupted font data detected";
|
||||||
|
}
|
||||||
|
*table = 0;
|
||||||
|
*length = 0;
|
||||||
|
@@ -915,8 +949,9 @@ static void getFamiliesAndSignatures(const QByteArray &fontData,
|
||||||
|
QList<QFontValues> *values)
|
||||||
|
{
|
||||||
|
const uchar *data = reinterpret_cast<const uchar *>(fontData.constData());
|
||||||
|
+ const uchar *dataEndSentinel = data + fontData.size();
|
||||||
|
|
||||||
|
- QList<quint32> offsets = getTrueTypeFontOffsets(data);
|
||||||
|
+ QList<quint32> offsets = getTrueTypeFontOffsets(data, dataEndSentinel);
|
||||||
|
if (offsets.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
@@ -924,7 +959,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData,
|
||||||
|
const uchar *font = data + offsets.at(i);
|
||||||
|
const uchar *table;
|
||||||
|
quint32 length;
|
||||||
|
- getFontTable(data, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length);
|
||||||
|
+ getFontTable(data, dataEndSentinel, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length);
|
||||||
|
if (!table)
|
||||||
|
continue;
|
||||||
|
QFontNames names = qt_getCanonicalFontNames(table, length);
|
||||||
|
@@ -934,7 +969,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData,
|
||||||
|
families->append(std::move(names));
|
||||||
|
|
||||||
|
if (values || signatures)
|
||||||
|
- getFontTable(data, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length);
|
||||||
|
+ getFontTable(data, dataEndSentinel, font, MAKE_TAG('O', 'S', '/', '2'), &table, &length);
|
||||||
|
|
||||||
|
if (values) {
|
||||||
|
QFontValues fontValues;
|
||||||
|
--
|
||||||
|
2.27.0.windows.1
|
@ -19,6 +19,7 @@ set(${PORT}_PATCHES
|
|||||||
GLIB2-static.patch # alternative is to force pkg-config
|
GLIB2-static.patch # alternative is to force pkg-config
|
||||||
clang-cl_source_location.patch
|
clang-cl_source_location.patch
|
||||||
clang-cl_QGADGET_fix.diff
|
clang-cl_QGADGET_fix.diff
|
||||||
|
CVE-2023-43114-6.5.patch
|
||||||
)
|
)
|
||||||
|
|
||||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "qtbase",
|
"name": "qtbase",
|
||||||
"version": "6.5.3",
|
"version": "6.5.3",
|
||||||
|
"port-version": 1,
|
||||||
"description": "Qt Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.",
|
"description": "Qt Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.",
|
||||||
"homepage": "https://www.qt.io/",
|
"homepage": "https://www.qt.io/",
|
||||||
"license": null,
|
"license": null,
|
||||||
|
@ -6978,7 +6978,7 @@
|
|||||||
},
|
},
|
||||||
"qtbase": {
|
"qtbase": {
|
||||||
"baseline": "6.5.3",
|
"baseline": "6.5.3",
|
||||||
"port-version": 0
|
"port-version": 1
|
||||||
},
|
},
|
||||||
"qtcharts": {
|
"qtcharts": {
|
||||||
"baseline": "6.5.3",
|
"baseline": "6.5.3",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"git-tree": "348dbf9cdcda0559adb72c98c249e06f8a2e50e8",
|
||||||
|
"version": "6.5.3",
|
||||||
|
"port-version": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git-tree": "8ff10ec91d1eda17f49dd867924e6e034a0abd5c",
|
"git-tree": "8ff10ec91d1eda17f49dd867924e6e034a0abd5c",
|
||||||
"version": "6.5.3",
|
"version": "6.5.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user