The QStandardPaths class provides access to OS-specific standard
locations on the filesystem, and also allows to search for files
within the defined directories. Other parts of the application
should be able to rely on the results returned by this class. Bugs
in this code can lead to severe issues like overwriting of user files,
reading configs from an incorrect place, or loading an incorrect
external code for execution. Therefore, the respective files are
marked security-critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: Id1a8189f2a7cde4a760446428551f2fe682d4073
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f10e599e3f6e5c77890281b44fad996542d60fca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 594012d43992da611218a22c9ab88753f0b092e9)
(cherry picked from commit 8458767d5619468a2d0fc414a8ac2c809a04dc40)
This class and its backends are mostly forwarding data without
inspecting it.
Qt still does some parsing itself and it has to interpret the
answers of underlying calls correctly. Therefore the QFSFileEngine
implementation is marked critical.
The iterator and the header files are marked significant.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I8ba5583fd044889b288174d02a8ac80583e52873
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5bd58d67c14ac765a2a0abb7d5dbb499ac60f13b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 259a3e29b7146c9889e02538f6ffd5875579cd5e)
(cherry picked from commit f8817a0c6809dfca44a3ae424b65b85faa9c7823)
QSettings can be parsed from *ini files that could potentially be
corrupted. Therefore qsettings.cpp and qsettings_mac.cpp are marked
security critical.
qsettings_[win|wasm].cpp are reading the settings from the registry
or from the browser, data sources that are considered trusted. Therefore
these files are marked security significant. The header are also marked
significant.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I5474c9a748b238734b5cdd50fb9e46f8379924ed
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 934a9345f703640f57b6cf65ba00eddd8487ac65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b96f25335259d5c93a097aa115d24e0fa63ae816)
(cherry picked from commit 5f081106dd6d331eaa0f3d178ae962c4d80f4695)
In qlockfile.cpp, the contents of the lock file are parsed. While this
parsing is not very advanced, it meets the criteria of QUIP 23. The
other files do not meet any QUIP 23 criteria and are therefore marked
as significant.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I87b2e00194583b5a2401443f556a38b472747c3a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 81d58eca8e0f8d181f52be0a4c923246a481ad43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ee48b3cefda3f1de744145aa572728e654017031)
(cherry picked from commit 80029fbf0c43b143428eeb836dae014fd8b0e64a)
QAbstractFileEngine::readLine reads from the file info data. The header
is not marked and will default to security significant.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I0dda64d78a515ed70a32777191af7c681cbfc067
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 961e6edd1378ad496978267f3f4791f340646253)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e58b9ab1b591c224e8ba25dc14148692eae2906a)
(cherry picked from commit adc18a9847831ae9c288126e7e70d327c543c06f)
qfiledevice.cpp contains some minimal data inspection, see
putCharHelper(). However, this is very simple and not sufficient to make
the file critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I76e608fa42b0bca003fc5d0166fd863583df075a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2eb3d79a578e13b686875fdce26b397a796d162f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d2d682e91473fd6cbe74fb29f2ae522342485bf5)
(cherry picked from commit 42dc822727a9ef25787c2db6a6a7167f50139754)
QBuffer operates on external data and data corruption issues have
been found before.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I6f9ccd58ec423142f3551af3ba4e3c20d3f8392f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4f84818a8c50d54dd72a5024dc2a430dc268bdb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 80df727a0bfccbe5d558e5cae48dbb3d127161e0)
(cherry picked from commit 474090152acbf889472c635229803124177c6757)
loadProviders() is parsing data, but it should only be trusted data.
The function isTextFile() apparently reads data from an untrusted file
to identify it as text file. Therefore this file has to be considered
security critical.
QUIP: 23
Task-number: QTBUG-135191
Change-Id: I8884293eff5584038f3388dc0309cfa70eae0c89
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3e88d518eb3ef0c7225e5f551e154ac22a37f578)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7560e3cec6df8128789415a1367622d257750a2b)
(cherry picked from commit da08a1a2d33b12c6132175f67ac3db584e6bb2b1)
QFileSystemEntry inspects paths, that can be provided by the user
following the code documentation. As such it has to be categorized as
critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I629c39bd1aedf216a067dab9a21eb09ad495b301
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e00985a8b9e4c5767447f95558f8a5703445045e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b16b7c49dddbc9461c3b047af97c2047e73def53)
(cherry picked from commit 5abb681243947fc5a408b5bf4d448f8148f1e24d)
QFileSelector inspects the paths to find the corresponding files.
Further there is the risk of exposing files of the resource system or
choosing files outside of the resource system by accident.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I6e0783da8bc08102df7cc108389db33940ffa4a6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit cca658d4821b6d7378df13c29d1dab53c44359ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e96fa69938735c271225e866963693c1edb3b794)
(cherry picked from commit a78f47814e67f7c6106dadef000cf132d1b37c25)
QWindowsPipeReader is a candidate for a security-critical class because
it is parsing data from an external process. The parsing is trivial
(e.g. searching \n in *.cpp line 243 or skipping characters) and
the data should arguably come from trusted sources. We still go for the
safe option and mark it as critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I79767534015370a5102929fee032b916be23d41d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b252eb381abb097c8fe2326b8bcb25459305ffe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9684f5c9be6900d4f8929d82e8b12b6bd748e3cb)
(cherry picked from commit 41b0f8c0ffe94602edce1806bf87ef38fa58f299)
Although we forward the heavy lifting of ZIP file parsing to zlib,
we perform some parsing ourselves, for example in
QZipReaderPrivate::scanFiles(). Therefore qzip.cpp is marked security
critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: Idf3b3f54fe3bb95e8c87052e850080b60dd364cb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 53cc56279cc71f1895e10c3f0d1d6f1d71f03923)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a1a7acca211202a756ee6def1f9da62ded74ab4b)
(cherry picked from commit 1903eb5e53a59fdadb55a9dbcc813ed89647a54a)
QDebug can be used to print strings from untrusted sources. Since
QDebug modifies these strings to improve their appearance, it parses
their contents as part of the formatting process. This behavior can
be exploited by attackers to trigger bugs in QDebug, making it a
potential attack vector. Therefore, mark it as security-critical.
Header and implementation files are marked.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I3d751f196a110354ef6c81aa9d2af5e2c88a9b6a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d9a0cbc36c14b58c567731e820f6ea83c2c4da36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ac1d232cbad7598c7a0537dfa9dc6fa378b413e3)
(cherry picked from commit 0c171b9ec45a2d9bcd8967c57f92c4416a151b2a)
QDir parses strings representing file paths. These strings may come
from untrusted sources, and even existing paths could be crafted to
trigger potential bugs in QDir. Therefore, this file is marked as
security-critical.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I817ad336ddc978c4cba1f385d60017f3a8f8e4fd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 655c74a54804965d59130af789efd1b83f76d71b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 731e38e094f3cf2973b6d9f0e9f05a7e8dd2129f)
(cherry picked from commit 8cd43045aa6d654e598d0b327ea6e8febfe8717d)
QIPAddressUtils is used to parse IP addresses from strings that are
potentially untrusted.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I6ccd4c9ffb87efc5c71e91099ef49ec326426b3a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 81e9adee48a72bcac3648a90f0646b777b852900)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e0b900c6c02fe8934607b1c59a9bc50e39562667)
(cherry picked from commit 523c55246c31807c3ad784949abc73087c4ce252)
QProcess is a central class to execute external code and communicate
with it. The program path is set by the developer and so are the
arguments. Path and arguments should not come from untrusted sources,
and the executed program must be trusted as well.
Nevertheless, a bug in this code might result in an easily exploitable
attack vector, e.g. by manipulating the PATH or the search order of
executables. Therefore, all related classes are marked security
critical. This includes the headers, as they are part of the external
execution machinery and define sensitive properties.
QUIP: 23
Task-number: QTBUG-135187
Change-Id: I34006b9adbf49ed8997c9eb1446b1f73654d7e51
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 027894b84b2544c1e944b856045e22c3167e721d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0d5803107b5136fc5454bf2543a04b09bc6fcd14)
(cherry picked from commit 8314eadb3eb102d41ebcdfcb077253d4a77771ba)
* qmimeprovider.cpp parses file names to identify the Mimetype,
* qmimemagicrule.cpp parses the file to identify its Mimetype.
* qmimeglobpattern.cpp implements a pattern matching algorithm, i.e.
glob parser.
All involve parsing of data that might come from untrusted sources.
QUIP: 23
Task-number: QTBUG-135191
Change-Id: I97d4cd8d635f05613d5a979c61038cef9c759989
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7d163200f9d6f47bce941969869c54369fc26056)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 924b8dd5847664313610d4016c49537538cb28ab)
(cherry picked from commit cf793190c720043b3caeb70a22f5f56bc12300b4)
The tika mimetype database contains multiple rules that would fit to a
valid file (e.g. svg file that is svg and xml) with the same priority
(50 in case of svg and xml). The choice is thus ambiguous which leads to
regressions in the reported mimetype.
In order to break ambiguity, we look now also at the sub-class-of
element and we prefer sub-classes as they are more narrow and detailed
than the super-class.
The recommended checking order of freedesktop.org suggests that this is
the correct thing to do: "If any of the mimetypes resulting from a glob
match is equal to or a subclass of the result from the magic sniffing,
use this as the result." However, this does not fit perfectly to the
case of the bug report because both results come from magic sniffing.
If two rules match and have the same priority, without one being a
sub-class of the other, there is still an ambiguity. In that case we
now print a warning about the ambiguity.
The patch adds a test for the previously ambiguous case. There is no
test for the warning on ambiguity, because such a test file would be
difficult to generate and is probably not worth the effort.
Fixes: QTBUG-133221
Change-Id: I1817ec4da947cd91729d0ce35defc9f63cd784d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 25df8042a4ac23e32037dfc1c20c599992febd66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3e0bcaeea22f83148df3d36b25cd55a7717c09f6)
(cherry picked from commit 4e482b055283b895c6646d11873dcad175e2f9c5)
While porting some of these tests to QUtf8StringView, Thiago suggested
to add the comparison tests from qcomparisontesthelper_p.h.
Change-Id: Id8f2c1c5690f7219ac000eebb637f48acbc5662d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1ecbad8da9828dc561268d0fce8c24239f0a7f2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1e51b8ac7b9af6d9cb2a75ee537a7873ab6d73f3)
QtCreator automatically removed this symbol when saving the file,
polluting my patch.
Therefore I put it into its own patch. As a driveby, I remove another
space at the end of the line.
Change-Id: I407f9ebe5fb6c8bfa0285c0fcba929c8866b2251
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1c0f02f3687054859c100a661cacfac883e4044d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ffd4b9637673c16aed87457de6b5ed43ee7b9be0)
This is a port from QLatin1StringView to QUtf8StringView.
Some functions of QL1SV have no counterpart to QU8SV:
* first() and last()
* count()
* indexOf()
* toUtf8()
that were not included.
Tests for user defined literals have also been removed. Some tests were
extended for utf8 string literals u8"".
Merge conflict resolution for 6.8: Remove test for arg().
Pick-to: 6.5
Task-number: QTBUG-132097
Change-Id: I0ceee00a7457360b430d13c3199f642f8e4c0036
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 9319f790604c89acafdefd8c7dd97f90bcc9a37b)
(cherry picked from commit c67ba77d347866906e97234e276bd9be7a427c3a)
Using MSVC 19.43 in C++20 mode leads to a compile error in
tst_qstringview. MSVC interprets QStringTokenizer as
std::ranges::sized_range because it found size() in the namespace
QtPrivate::Tok. QStringTokenizer is derived from a class in that
namespace.
Naturally this leads to a compile error because QStringTokenizer has no
size member function as required in QtPrivate::Tok::size():
qstringtokenizer.h(118): error C2039: 'size': is not a member of
'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(232): note: see declaration of
'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(118): note: the template instantiation context
(the oldest one first) is
tst_qstringview.cpp(680): note: see reference to function template
instantiation ...
The problem can be avoided by renaming QtPrivate::Tok::size() to
tokenSize. MSVC 19.43 interprets QStringTokenizer as std::ranges::range
that do not need the size() member function.
Change-Id: Ib94db8e4d840a143bbf693c89e3714e1528a0267
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eabbc15a5b0cb1b1866778fa014bd599d38f1695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6276f26bda4a3e177d39ff055efe813647375085)
If debug symbols are needed, then pass the respective flag to the
configure script.
Change-Id: I99db92bdd5b7eb896e0d592117a8f218467a4bd7
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 355e0d85eb4a05acd4d5c9d6b2f1cfce7ccdb144)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5405f6b575800aa9701eb15e09934bc38ac3ac40)
gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) seems to remove some
code in release builds that is embedded in a macro in qtransfrom.cpp.
This patch changes the macro into a function such that it is not
removed by gcc.
It seems like the switch statement is (wrongly) optimized away if it is
embedded in the QTransform::map(QPolygonF) overload. nx and ny are
always 0 (as initialized by QPolygonF) after the macro (but only within
the QTransform::map(QPolygonF) function.
The bug happens only in a release build. Added debug messages of nx and
ny created no output, adding qDebug() << t, which made the macro work.
It seems that a complex combination of macro and switch statement can
tigger the bug in gcc. So rewriting the macro as a function works around
the bug.
Fixes: QTBUG-127723
Change-Id: I7e0b02cde276e591cf773f4e18dd505134421957
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 11b70b66de627d3bd0ef4193d5cfa624c88ac96a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
RFC 9913 differentiates between stream errors and connection errors.
Some error handling only requires stream errors in the form of
RST_STREAM frames, while other sever errors require connection errors
in the from of GOAWAY frames.
This patch streamlines the sending of RST_STREAM frames, and ensures
that they are sent whenever mandated by RFC 9113. In some cases this
was missing, in some cases we were sending connection errors instead
of stream errors.
Further this patch adds tests to ensure the correct behavior.
Fixes: QTBUG-122345
Pick-to: 6.7
Change-Id: Ic93ae7a358a4eb551aa23342a6683cdd5dd0abb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d17d260948e16549d82f1fdd4dec98d246b0622e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The QRegularExpression capture-by-name keys are currently QStringViews,
but are only ever used to compare them against a const char16_t*, so
this API is a perfect candidate for replacing all of these overload sets
with a single QAnyStringView function.
[ChangeLog][QtCore][QRegularExpression] Keys can now be passed as
QAnyStringView (was QStringView).
Fixes: QTBUG-103097
Change-Id: I1a80e85f301cc08370d70b3b5eb0ae10c6a51f33
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
On MSCV x86 (32bit) the comparison of qsizetype with
std::numeric_limits<quint32>::max() leads to a warning.
This patch adds a static cast to avoid the warning.
This is an ammendment to 28ecb523ce
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Ie50572165ac31aafa7d23570bc133c5c96cf8b00
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
* Added icons to the controller.
* Keep the car within the scene.
* Removed the ui file because 4 buttons can be maintained in code easier.
Change-Id: I10af821beb442939e1e7fbdd3ffbde67a272bb2f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The shaped clock example has the appearance of the analog clock, which
was refurbished with 619ec1a640. This
change applies the refurbished design to the shaped clock.
Task: QTBUG-118871
Pick-to: 6.6
Change-Id: Ibcfc8e9fb239a1c6f7ea685f6cab1e50b2060a53
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Currently items can get stuck in a hovered state when all fingers are
lifted from a touchscreen. This is because we don't react to the
WM_POINTERLEAVE event from Windows. With this patch we translate a
WM_POINTERLEAVE event to a LeaveEvent to remove the hover state from
QtQuick items.
Fixes: QTBUG-62912
Pick-to: 6.5 6.6
Change-Id: I8a6fb6b7ec77457854a75e20277565d1eb89bab6
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Some users wish to make layouts with uniform column widths or
uniform row heights, ignoring the sizeHints of individual items.
This patch enables this mode in the QGridLayoutEngine, used
by the QuickLayout.
The sizeHints are aggregated and their average preferred size
and extreme minimum and maximum sizes are respected in the
layout.
Change-Id: Ibb9409eb0a11a1ce8bb305f44a4cb0071c871ec9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>